mixpanel / mixpanel-js

Official Mixpanel JavaScript Client Library
https://mixpanel.com/help/reference/javascript
Other
884 stars 308 forks source link

Device_id is set as canonical distinct_id even though identify is called with the email #383

Open anand-jain-official opened 1 year ago

anand-jain-official commented 1 year ago

I'm calling identify with the email id of the newly signed up user but the subsequent events are still taking the device id as the canonical distinct_id such that on the Events table, it's difficult to filter by email. How can i ensure the canonical distinct_id of the events is the email i pass to the identify method and not device_id?

Same problem documented here: (fix suggested there not working consistently) https://stackoverflow.com/questions/69944125/showing-a-default-distinct-id-in-mixpanel-instead-of-mixpanels-own-arbitrary-ch

csiden commented 1 year ago

It sounds like your project is on the original ID merge API which does not allow you to control what the canonical distinct ID would be. The normal way to deal with this sort of thing in the original API would be to not rely on distinct_id when filtering and instead set a user property with the user's email address and filter based on that user property.

Earlier this year Mixpanel did release a new simplified ID merge API, which sounds like it behaves more along the lines of what you are expecting (when you call identify(<id>) that <id> will always become the canonical ID). However, there is no way to change this setting on an existing project, but if you are just getting started you could start a new project and change this setting on it: https://docs.mixpanel.com/docs/tracking/how-tos/identifying-users#how-do-i-switch-between-the-simplified-and-original-api

Linkmetal commented 1 year ago

Same problem here and I cannot restart the project. Also the issue seems to be arbitrary, sometimes it works properly but then some users get this type of Identify event image

As you can see, it seems that it has the DistinctId before identity properly setted, (wich is not true, it has the random uuid setted before identity) and then is setted to the debice uuid, when I'm sending the identify event with the user email.

Anyone knows any workaround or any way to try to fix this?

Edit: It seems that the email is correctly saved into the user in list of "ids", so the problem is that I cannot make the email the default one to be shown