Events
Record named actions with properties using track().
An event is a named action with optional properties. track is how you record the actions that matter to your product.
Track an event
Trodo.track('signup_completed', { plan: 'pro', source: 'pricing_page' });// distinct id first, or bind once with forUser
await trodo.track('user-42', 'signup_completed', { plan: 'pro' });
const user = trodo.forUser('user-42');
await user.track('signup_completed', { plan: 'pro' });trodo.track('user-42', 'signup_completed', {'plan': 'pro'})
user = trodo.for_user('user-42')
user.track('signup_completed', {'plan': 'pro'})The browser SDK is stateful (it remembers the identified user). The server SDKs are stateless, so you pass the distinctId / distinct_id first, or bind once with forUser / for_user.
Properties
Properties describe the event and make it filterable and breakdownable later. Keep values to scalars and short strings, and name them consistently:
Trodo.track('order_completed', {
amount: 49.99,
currency: 'USD',
items: 3,
coupon: 'LAUNCH20',
});Every event also carries the user, session, page, device, geo, and UTM context automatically. See Auto-capture.
Auto vs. custom events
Auto-capture records generic interactions (clicks, page views, forms). Add custom events for the business-specific actions on top:
// auto-capture already logged the element_click;
// this adds the business meaning:
Trodo.track('agent_run_started', { workflow_id: 'weekly_report', model: 'gpt-4o' });Next
- Identity to attribute events to a user
- People for persistent user traits
- Auto-capture for what's tracked automatically