Skip to content

Traits don't update when using certain settings #102

@cerupcat

Description

@cerupcat

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions