Identity
Attribute activity to a user and merge anonymous and identified sessions.
Every user has a distinct ID. Anonymous activity is tracked under a generated ID; when you identify, that activity merges into the real user's profile.
identify
Call identify with a stable identifier (an email, your database ID) when the user logs in or signs up.
Trodo.identify('user@example.com');
// the distinct id is now remembered; later calls attribute to this userconst user = await trodo.identify('user@example.com');
await user.track('login');user = trodo.identify('user@example.com')
user.track('login')Anonymous to identified
Before login, events are tracked under an anonymous ID. The first identify after that merges the anonymous events into the identified profile, so the pre-login and post-login timelines become one.
One identity across browser and backend
Call identify with the same value on the browser and your backend, and all activity, client and server, lands on a single profile.
Trodo.identify('user@example.com');await trodo.identify('user@example.com');reset (browser)
On logout, clear the stored identity so the next visitor starts anonymous:
Trodo.reset();