davide-scalzo/react-native-mixpanel

Calling .reset() forcibly re-identifies the user causing issues with identity merge

JSanchezIO opened this issue · 2 comments

Problem

Mixpanel introduced identity merge which allows you to call .identify(SOME_USER_ID) and Mixpanel will then merge the profiles for the id you pass in, in this case, SOME_USER_ID, and the anonymous id of the user prior to identification. This scenario is currently supported by this library. However, signing out causes some issues. This is because on signout Mixpanel recommends calling .reset() to get a new anonymous id for the current user. In this implementation, when we call .reset() we immediately call .identify() with a newly generated id, for ease-of-use. With calling .identify() on .reset() we are implicitly merging the newly generated id with the anonymous id. This causes problems because identity merge will not work on anonymous ids that have been already merged.

Possible Solutions

  • Allow the user to pass a boolean to .reset() to toggle auto-identifying the user
  • Remove auto-identification from .reset()

Mixpanel's Identity Merge Flow

Mixpanel's Identity Merge Flow

@JSanchezIO I see you closed this issue. Were you able to resolve this, or did you maybe just close it because the library is now deprecated?

@jpalmieri I don't recall, the codebase that I was using this in is no longer active. I believe it was because of the PR that was merged to solve this.