Skip to content Skip to sidebar Skip to footer

Checking If A "distinct_id" Already Exists In Mixpanel Javascript

Is there a way to check to see if a previous 'distinct_id' already exists in Mixpanel with Javascript? I am currently having an issue where once someone moves through my onboarding

Solution 1:

It would be great to see your code, but I can guess the following answer based on my experience:

The first time you create a people profile, you should create it executing mixpanel.alias(YOUR_DISTINCT_ID) instead of mixpanel.identify(). This will associate the mixpanel internal distinct_id with your custom distinct id (for instance: an email address, an username, etc).

Next time the user lands on a different page, you call mixpanel.identify(YOUR_DISTINCT_ID).

Doing so, if the user logs out, and then logs in back, calling mixpanel.identify(YOUR_DISTINCT_ID) will be enough, Mixpanel is going to associate your custom id with the original one avoiding duplicated profiles.

Post a Comment for "Checking If A "distinct_id" Already Exists In Mixpanel Javascript"