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

Old traits are set on new user #93

Open
cerupcat opened this issue Feb 8, 2021 · 3 comments
Open

Old traits are set on new user #93

cerupcat opened this issue Feb 8, 2021 · 3 comments

Comments

@cerupcat
Copy link
Contributor

cerupcat commented Feb 8, 2021

Users that logout and create another account are associated to the original user.

I'm currently performing the following:

  • Initialize Segment
  • Identify when a user logs in and set a trait for email.
  • Reset when the user logs out
  • Identify when new user logs in (or creates account) and set trait for email.

The second user is associated with the first in amplitude and the email trait is not set.

@cerupcat cerupcat changed the title Old user being associated to new user Old traits are set on new user Feb 11, 2021
@cerupcat
Copy link
Contributor Author

cerupcat commented Feb 11, 2021

Doing some more research, it's unclear if this is an Amplitude bug or Segment bug.

When calling identify in the Segment SDK, the Amplitude SDK method is called - (void)identify:(AMPIdentify *)identify. However, the identify.userPropertyOperations are the traits that were first set in the first identify call, not the most recent traits in the identify call and therefore previous traits are set on new users when identify is called.

@cerupcat
Copy link
Contributor Author

cerupcat commented Feb 11, 2021

On -(void)reset, reinitializing the identify in SEGAmpltidueIntegration.m seems to solve this.

- (void)reset
{
    [self.amplitude setUserId:nil];
    SEGLog(@"[Amplitude setUserId:nil");

    [self.amplitude regenerateDeviceId];
    SEGLog(@"[Amplitude regnerateDeviceId];");
    
    self.identify = [AMPIdentify identify]; // NEW CODE
    SEGLog(@"[Amplitude reset identify];");
}

@cerupcat
Copy link
Contributor Author

Pull request: #95

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