davide-scalzo / react-native-mixpanel

A React Native wrapper for Mixpanel tracking
MIT License
455 stars 195 forks source link

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

Closed JSanchezIO closed 3 years ago

JSanchezIO commented 3 years ago

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

Mixpanel's Identity Merge Flow

Mixpanel's Identity Merge Flow

jpalmieri commented 2 years ago

@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?

JSanchezIO commented 2 years ago

@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.