Analytics

Google Analytics 4 configuration and complete catalog of custom events tracked across Testio.

Client-side events

Frontend · gtag.js

Fired directly from the browser via window.gtag('event', ...). Implemented in apps/web/src/lib/analytics.ts.

Event When it fires Parameters
login User completes login successfully. method
sign_up_started User lands on the /register page.
sign_up User completes registration (with or without paid plan). method plan
project_created A new project is created from the Dashboard. project_id
experiment_started An experiment transitions from draft to running. experiment_id
begin_checkout User clicks an upgrade/subscribe button, just before the redirect to Stripe. value currency billing_cycle items
purchase User returns from Stripe Checkout with ?success=true and subscription is verified ACTIVE. transaction_id value currency items

Server-side events

Backend · Measurement Protocol

Fired from the API via GA4 Measurement Protocol for events that happen outside a browser session (Stripe webhooks). Implemented in apps/api/src/services/analytics.ts. Requires the GA4_API_SECRET env var on the server.

Event When it fires Parameters
subscription_renewed Stripe webhook invoice.payment_succeeded with billing_reason = subscription_cycle (recurring rebill). transaction_id plan billing_cycle value currency
subscription_canceled Stripe webhook customer.subscription.deleted. plan billing_cycle
Note: Server-side events require GA4_API_SECRET to be set in the production .env file. Create the secret at GA4 Admin → Data Streams → (stream) → Measurement Protocol API secrets. Without it, the server helper is a silent no-op (frontend events are unaffected).