How identifying works
Distinct IDs, how anonymous visitors are merged into identified users, when a merge is refused, and when to use alias and reset.
My Journey Analytics recognises people by their distinct ID. Every event carries one, and each distinct ID belongs to exactly one person. A person can have many distinct IDs: one for each browser they used anonymously, plus the ID you identify them with.
For the calls themselves, see Identifying users.
Anonymous to identified
- A new visitor gets a random distinct ID, stored in their browser.
- When you call
myjourney.identify("user_123"), the library sends an$identifyevent carrying both the new ID and the anonymous one. - The two IDs are joined into one person. The visitor's earlier anonymous events now belong to
user_123, and so does everything they do from now on.
If the same user later signs in on their phone, the phone's anonymous ID is joined to user_123 too, so one person holds their activity from both devices.
When a merge is refused
To protect your data, some merges are refused. Each refusal is listed in Event ingestion warnings.
- Two identified people are never merged by
identifyoralias. If the other ID already belongs to a person who was identified as someone else, the merge is refused and the two people stay separate. - Placeholder IDs are refused. IDs such as
anonymous,guest,id,email,distinct_id,not_authenticated,true,false,null,none,undefined,NaN,0and[object Object], or an empty string, usually come from a bug, and merging on them would join unrelated people.
Where properties go after a merge
When two people are merged, the identified person's properties win wherever both people have a value for the same property. Properties that only the anonymous person had are kept.
Alias
alias joins another distinct ID to the current user without changing which ID the browser uses:
myjourney.alias("backend_789");Use it when the same person is known by a second ID elsewhere, for example in your back end, and you want events sent with either ID to land on the same person. The same rule applies as for identify: an ID that already belongs to another identified person is not merged.
Most sites never need alias; using one stable ID with identify everywhere is simpler.
Reset
myjourney.reset() forgets the current distinct ID and starts a new anonymous one. Call it when a user signs out, so that whoever uses the browser next is not added to the previous person. Without it, anything the next visitor does before signing in is recorded against the last user.
Choosing distinct IDs
- Use your own system's user ID for identified users.
- Keep it stable: changing a user's ID later creates a second person.
- Use the same ID from your website, your server and any other source, so all their events land on one person.
Related
Can't find what you need? Contact support