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

Traits don't update when using certain settings #102

Open
cerupcat opened this issue Jul 13, 2021 · 0 comments
Open

Traits don't update when using certain settings #102

cerupcat opened this issue Jul 13, 2021 · 0 comments

Comments

@cerupcat
Copy link
Contributor

cerupcat commented Jul 13, 2021

When using traitsToIncrement or traitsToSetOnce, the traits that aren't incremental or set once don't override the current user properties in amplitude.

I've testing by calling [self.amplitude setUserProperties:payload.traits]; directly and the traits correctly update/override. However, when a incremental or setOnce trait is used (via Segment dashboard settings), this call isn't used an instead it calls:

- (void)incrementOrSetTraits:(NSDictionary *)traits
{
    for (NSString *trait in traits) {
        id value = [traits valueForKey:trait];
        if ([self.traitsToIncrement member:trait]) {
            [self.amplitude identify:[self.identify add:trait value:value]];
            SEGLog(@"[Amplitude add:%@ value:%@]", trait, value);
        } else if ([self.traitsToSetOnce member:trait]) {
            [self.amplitude identify:[self.identify setOnce:trait value:value]];
        } else {
            [self.amplitude identify:[self.identify set:trait value:value]]; // don't override traits and is essentially a set once
            SEGLog(@"[Amplitude set:%@ value:%@]", trait, value);
        }
    }
}

[self incrementOrSetTraits:payload.traits]; is called and the function will fail to override traits that already exist rather than calling [self.amplitude setUserProperties:payload.traits]; which appears to work as expected.

The error amplitude will log:

        AMPLITUDE_LOG(@"Already used property '%@' in previous operation, ignoring for operation '%@'", property, operation);
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