Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple users on same ios device not working as I would expect #117

Open
bartboersma opened this issue Nov 9, 2020 · 2 comments
Open

Comments

@bartboersma
Copy link

Hi,

I had an issue with multiple users on the same device (ios in this case). I posted my question here:
https://community.mixpanel.com/sending-data-to-mixpanel-11/multiple-users-on-same-device-not-working-as-i-would-expect-4872

Key question is as follows:
Why does a reset() not set a new random distinctId, but reverts it back to the old 'anonymous' distinctId.

Example:

  1. Anonymous user browses app with distinctId 98CB5B1C-7922-44C8-8FAC-ED03BD1BB564
  2. user logs in (identify called with userId 144). DistinctId is now 144.
  3. user browses app and all event correctly get distinctId 144.
  4. user logs out (reset method is called). Distinct Id gets set back to 98CB5B1C-7922-44C8-8FAC-ED03BD1BB564 instead of a random new distinctId. I think it should be a new random distinctId based on the documentation:
    "Reset generates a new random distinct_id and clears super properties." (source: https://developer.mixpanel.com/docs/swift).

After diving into this repository I saw the following line of code in the reset() method:
self.distinctId = self.anonymousId;
on line 945 in https://github.com/samzilverberg/cordova-mixpanel-plugin/blob/master/src/ios/Mixpanel/Mixpanel.m

Is this expected behaviour or should it be set to a new random distinctId (new UUID)? Am I missing something?

Cheers,

Bart

@bartboersma
Copy link
Author

Worth noting is that I tested it on Android which doesn't have this 'bug'. On android when a user logs out (call reset()) the new event gets a new unique distinctId. Note the difference in distinctId onHomePage before calling identify (f9996458-1430-487f-91f7-c95acbe645b6) and after logout onLoginPage after calling reset (2faa0443-7ecf-4f4d-b9a2-95c060c68b24).

Screenshot 2020-11-09 at 14 40 45

@bartboersma
Copy link
Author

Apparently, this is well known in their implementation, see: mixpanel/mixpanel-swift#139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant