Mixpanel For Developers Id Management
Overview
This section provides details on implementing Mixpanel's Identity Management called Identity Merge (ID Merge for short). Note that the Legacy Identity Management (opens in a new tab) is not covered in this section as Identity Merge is enabled by default for all new organizations since March 2020.
Basic Concepts in ID Merge
ID Merge Implementation (using Client-side SDK)
ID Merge Implementation Best Practices
Call mixpanel.identify upon a successful sign-up / login or when an app is re-opened in a logged in state
By calling mixpanel.identify at these specific points in user journeys, you would be able to link the pre and post-login events to the same user on Mixpanel. Besides, calling mixpanel.identify when the users re-open the app in a logged in state ensures that all events in the session are tracked with the user's identifier such as user id.
Track the unique identifier as a super property and user property to assist troubleshooting
You can track the user's unique identifier as a super property via mixpanel.register (opens in a new tab) and user property via mixpanel.people.set (opens in a new tab) as soon as it is available in the app i.e. on a successful sign-up / login or when an app is re-opened in a logged in state. In the cases when ID Merge is not implemented properly, you can rely on these properties for troubleshooting purpose.
Avoid creating profiles for anonymous users
Avoid creating profiles for anonymous users. If possible, cache user profile properties updates in cookie or local storage and only send them to Mixpanel after the user is identified (ie logged-in state).
QA your ID management implementation during development phase
Here are a few things to look out for:
- Ensure that cross-platform, pre and post-registration events are linked to the same user on Mixpanel.
- Ensure that no duplicate profiles are created as the users go through the onboarding, registration, login and cross-platform user journey.
- Ensure that all the user’s identifiers are stored in the same Identity Cluster and all their events are displayed on a single profile on Mixpanel.
Keep a record of your ID management implementation
We encourage you to document your implementation (or create a diagram of the implementation). This will come in handy when you need to re-implement this on a new platform or troubleshoot ID management issue.
Read more about ID Merge Implementation Best Practices (opens in a new tab)