Events
Event tracking
identify, track, trackDurable, and flush.
Last updated on
Browser and Node clients share the same core methods:
identify(userId, traits)sets the user and queues an identify-side effect according to the core client.setTraits/setTraitupdate traits without a new user id.reset()clears the identity. Flag state is dropped so the next user does not inherit flags.track(name, properties)queues a track event and returns immediately.trackDurable(name, properties)waits until the event is persisted locally.flush(timeoutMs)pushes the queue.shutdown(timeoutMs)flushes and stops.
On Node, track also accepts { event, userId, properties }. If userId is set, the client identifies first. withIdentity({ userId, anonymousId, traits }) returns a new client bound to that identity, which is the usual server pattern per request.
React applications should call useTrack() rather than importing a global client into a render.
Was this page useful?