Skip to main content
By default, Tracelit tracks anonymous sessions. If you call identify() after a user logs in, every event from that point on (and future sessions on that device) will be linked to that user in your dashboard. Tracelit session replay player header showing an identified user with their ID, email, and plan traits

Basic usage

Call identify() as soon as you know who the user is — after login, after an auth check, or anywhere you have access to their ID.
Pass optional traits as a second argument — any key-value pairs you want visible in the dashboard:
You don’t have to send an email. The user ID can be any string — a database UUID, a hashed value, a display name. Email is just an optional trait.

What happens in the dashboard

After calling identify():
  • Sessions show a user chip — click it to see all sessions for that user
  • Filter the sessions list and error log by user ID or email trait
  • The replay player header shows the identified user’s ID and traits
  • The replay timeline shows a Identified as user_abc123 marker at the exact moment identify() was called
  • Errors are linked to the user, so you can see all errors a specific person experienced

Reset on logout

Call reset() when the user logs out. This clears the stored identity so future sessions are anonymous again.
The identity is stored in localStorage and persists across page loads. If you don’t call reset(), the next session on the same device will still be linked to the same user.

React example


Next.js App Router example

Split the init and identity concerns into two components — keeps things clean:

Script tag (plain HTML)

If you’re using the script tag approach, you can call identify() on the global __tl object — it’s safe to call before the SDK finishes loading:

Privacy notes

The user ID and traits you pass are stored on your Tracelit project. Nothing is inferred — Tracelit only stores exactly what you send.
Yes, as long as you treat it like any other user data. If a user requests deletion, delete their record via the Tracelit dashboard. Call reset() client-side on logout so no future sessions are linked to them on that device.
Absolutely. The email trait is optional, and you can pass any opaque key as the user ID. A SHA-256 hashed email or a database UUID both work fine.
In debug mode, the SDK warns you if a trait key looks sensitive — for example, password, token, card, or ssn. These warnings appear in the browser console.

Use this AI prompt


API reference