Event Tracking
Track product analytics events to understand user behavior. Events power your DAU/WAU/MAU metrics, trend charts, and breakdowns.
Basic Usage
typescript
gl.track("page_view", { page: "/pricing" })
gl.track("signup", { plan: "pro", distinctId: "user_123" })
gl.track("purchase", { amount: 29, currency: "USD", distinctId: "user_123" })
Event Naming
Use consistent, lowercase names with underscores. Some recommended conventions:
page_view— page loadssignup/login— auth eventspurchase/subscription_created— revenue eventsbutton_click/feature_used— engagement
Distinct ID
Pass a distinctId to identify unique users. This enables DAU/WAU/MAU calculations and retention analysis.
Dashboard
View events in Analytics — see overview cards (DAU, total events), top events by count, and 7-day trend charts per event.
Tip: Events from public keys (gl_pk_) work from the browser. No CORS configuration needed.