Event Tracking Methods
Methods for tracking events, identifying users, and managing user sessions.track
Track a custom event with optional properties.Event name. Use descriptive names like
Button Clicked or Purchase Completed.Optional event properties. Can include any JSON-serializable data.
Returns
void
Example
identify
Identify a user and associate events with them.User ID. Should be a unique identifier for the user.
Optional user traits. Properties that describe the user.
Returns
void
Example
page
Track a page view.Optional page name. If not provided, will use the current page path.
Optional page properties.
Optional page category.
Returns
void
Example
group
Associate a user with a group or organization.Group ID. Should be a unique identifier for the group.
Optional group traits. Properties that describe the group.
Returns
void
Example
alias
Merge anonymous and identified user identities.New user ID (the identified user ID).
Previous user ID (usually the anonymous ID). If not provided, will use the current anonymous ID.
Returns
void
Example
reset
Reset user identity and start a new session. Useful when a user logs out.Returns
void
Example
flush
Force immediate sending of all queued events.Returns
Promise<void>
