Appearance
Identifying users
Every visitor gets an anonymous id, stored on their device. When someone logs in, call identify() with your own id for them, so their events can be linked across devices and sessions.
js
// After a successful login, and on each page load while logged in
vectelle.identify(user.id)
// On logout
vectelle.reset()Which id to use
Use your database's internal, stable id, such as "usr_8f2k" or "48213". Don't use an email address, username or anything else that identifies the person.
If you pass an email address by mistake, the server replaces it with a one-way hash before storing it. That's a safety net, not a feature: send your internal id.
User ids can be up to 256 characters.
What identify does
- Events after
identify()carry both the anonymous id and the user id. Events before it keep only the anonymous id, but the shared anonymous id links them. - The user id is saved on the device, so you don't need to wait for
identify()on every page load, though calling it again is harmless.
What reset does
reset() forgets the user id, creates a new anonymous id, starts a new session, and clears properties set with register(). Call it on logout so the next person on a shared device isn't linked to the previous one.