Our app uses the identify() method right after user login, passing the MongoDB user ID as the identifier. Most of the time, this works as expected. However, sometimes I observe the following behavior:
-
The identify event appears in the Mixpanel dashboard, but it assigns the previous random distinct_id (generated before the user logged in) instead of the MongoDB user ID.
-
This issue occurs more frequently when switching accounts after calling reset() and then calling identify() again after the new user logs in.
When I check the distinctId locally using Mixpanel.mainInstance().distinctId it correctly shows the MongoDB user ID.
Here is it working as expected when I switch to another user
SDK Version: v4.3.1 (latest)
// On login
Mixpanel.mainInstance().identify(distinctId: mongoUserId)
//Check if user id is correct
Mixpanel.mainInstance().distinctId
// On logout
Mixpanel.mainInstance().reset()
It's pretty much the same issue as this one but on iOS
mixpanel/mixpanel-react-native#207