Documentation Index
Fetch the complete documentation index at: https://docs.getzenstep.com/llms.txt
Use this file to discover all available pages before exploring further.
Method reference
| Method | Parameters | Returns | Description |
|---|---|---|---|
identify() | userId: string, attributes?: UserAttributes | void | Associate session with a known user |
track() | event: string, data?: Record<string, unknown> | void | Send a custom behavioural event |
identify()
Associate the current browser session with a known user ID and optional attributes.track()
Send a custom behavioural event. Events are stored in analytics and can be used in targeting rules.Internal properties
_q
identify() and track() are pushed here as tuples. After initialisation, the queue is drained and _q is an empty array.
Do not write to _q directly — use the methods above.
TypeScript declaration
Copy this global declaration into your project to get full type safety:Error handling
All methods catch errors internally. If the Zenstep snippet encounters an error processing anidentify() or track() call, it logs a warning to the browser console ([Zenstep] identify error: ...) and continues. Your application code will never throw due to a Zenstep call.
Versioning
The snippet API follows semantic versioning. Breaking changes to the public API surface will increment the major version and be announced in the changelog. The CDN URL (/v1/snippet.js) pins you to the v1 major version — you will receive backward-compatible updates automatically.