Mixpanel Community Icon

Integrating Mixpanel SDK to Associate Anonymous IDs with Custom IDs

·
·

Hi Team I am logged out right now and doing some actions on the site and that data is flowing under anonymous ID say id1 and as soon as I logged in, I want to set my custom ID say CID against id1 and all the events flown under id1 should be tagged to CID. Now, when I am moving to another browser and doing some actions under anonymous ID say id2 and as soon as I logged in, I want to pass on all the events moved from id2 to CID How can I achieve this from mixpanel sdk or api?

  • Avatar of Thena
    Thena
    APP
    ·
    ·

    Hi Bhagyashree! Julianne from Mixpanel Support here. Diving right in, Mixpanel's Identity Management system is built to be able to meet this use case. Here's a high-level overview of the process: 1. When a user visits your site and is not logged in, events are sent with an anonymous ID. If using a Mixpanel client-side SDK, the anonymous ID will be automatically generated. 2. When the user logs in, you should call the identify() with your custom ID (CID). This tells Mixpanel to associate all future events with the provided custom ID. This also merges the anonymous ID and the custom ID into an Identity Cluster, which tells Mixpanel that these two IDs represent the same user. Please note that it can take up to 24 hours for the mapping of the new anonymous ID to the CID to take effect and propagate throughout Mixpanel. 3. If the user then moves to another browser and performs some actions while not logged in, the events are sent with a different anonymous ID. When the user logs in on this new browser, you should again call the identify() method with the same custom ID. This adds the new anonymous ID to the same Identity Cluster, and all events associated with this new anonymous ID are now also associated with the custom ID. The Identifying Users doc has more information about the process and examples of user flows. Note, the doc linked is for Simplified ID Merge. You can confirm your project's ID Merge version in the project settings. 

  • Avatar of Bhagyashree B.
    Bhagyashree B.
    ·
    ·

    Yeah.. resolved now

  • Avatar of Bhagyashree B.
    Bhagyashree B.
    ·
    ·

    Thanks!