Guides
Identify users
Link anonymous visitors to your users, set person properties, use aliases, groups and reset on logout.
Identify after login
Before login a visitor has an anonymous id. Call identify with your own user id as soon as you know it: past and future events are linked to one person, on every device.
tracklyne.identify(
user.id,
{ email: user.email, plan: user.plan }, // $set : updated every time
{ first_plan: user.plan }, // $set_once : kept from the first call
);On the server: tl.identify({ distinctId, properties: { $set } }). On iOS: Tracklyne.shared.identify(id, userProperties: [...]).
Use a stable id that never changes, such as your database id, not an email address.
Reset on logout
Call tracklyne.reset() when a user logs out, so the next person on the same device starts with a new anonymous id.
Companies and groups
For B2B products, attach events to a company to analyse accounts, not just people:
tracklyne.group("company", "acme", { name: "Acme", seats: 40 });Aliases
tracklyne.alias("crm-1234") adds another id to the current person, useful when a backend system knows the user by a different key.