Learn how Distinct Id, Identify, and Alias work to track your users as they go from anonymous visitor to known visitor, and from one device to the next.
Welcome to Mixpanel identity management.
In this video, we’ll learn the key building blocks of how user identity works in Mixpanel. Identity management is how Mixpanel attributes properties and events performed on your application to a specific user. Mixpanel automatically assigns an identifier, known as distinct_id, to anonymous users when they first use your application. This distinct_id must be consistent across all actions of a user.
Let’s use Mixpanel’s Live View report to observe how this user’s distinct id stays consistent throughout their lifecycle. As your user moves from being anonymous to authenticated, you may want to assign your user a new ID. The alias method maps a new ID from your end -- like username, email, or internal ID -- to the distinct_id. This way you don’t have to store Mixpanel’s distinct_id on your backend. After a successful alias, you can identify users by their new ID going forward as it will map to the original distinct_id.
The identify method modifies your user’s distinct_id on their device. This way if a user switches devices you can still attribute their actions by calling identify on the aliased ID. You can check for a successful alias by making sure the original distinct_id matches in Live View. We support the alias and identify methods in all of our libraries.
Below are the calls for three of our most common libraries. Remember, if you use the alias method, only call it once during sign up and identify during login -- this will keep distinct id consistent. Avoid calling identify before alias.
If you find yourself with a unique use case or just have questions, please contact us.