AMPIdentify Class Reference

Inherits from NSObject
Declared in AMPIdentify.h
AMPIdentify.m

Overview

AMPIdentify objects are a wrapper for user property operations, which get passed to the identify method to send to Amplitude servers.

Note: if a user property is used in multiple operations on the same Identify object, only the first operation will be saved, and the rest will be ignored.

Each method adds a user property operation to the Identify object, and returns the same Identify object, allowing you to chain multiple method calls together.

Here is an example of how to use AMPIdentify to send user property operations:

AMPIdentify *identify = [[AMPIdentify identify] add:@"karma" value:[NSNumber numberWithInt:1]];
[[identify set:@"colors" value:@[@"rose", @"gold"]] append:@"ab-tests" value:@"campaign_a"];
[[Amplitude instance] identify:identify];

See User Properties and User Property Operations

+ identify

Creates a nwe AMPIdentify object.

+ (instancetype)identify

Return Value

a new AMPIdentify object.

Discussion

Creates a nwe AMPIdentify object.

Declared In

AMPIdentify.h

– add:value:

Increment a user property by a given value (can also be negative to decrement).

- (AMPIdentify *)add:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

The amount by which to increment the user property.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Increment a user property by a given value (can also be negative to decrement).

If the user property does not have a value set yet, it will be initialized to 0 before being incremented.

Declared In

AMPIdentify.h

– append:value:

Append a value or values to a user property.

- (AMPIdentify *)append:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to append.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Append a value or values to a user property.

If the user property does not have a value set yet, it will be initialized to an empty list before the new values are appended. If the user property has an existing value and it is not a list, the existing value will be converted into a list with the new values appended.

Declared In

AMPIdentify.h

– prepend:value:

Prepend a value or values to a user property. Prepend means inserting the value or values at the front of a list.

- (AMPIdentify *)prepend:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to prepend.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Prepend a value or values to a user property. Prepend means inserting the value or values at the front of a list.

If the user property does not have a value set yet, it will be initialized to an empty list before the new values are prepended. If the user property has an existing value and it is not a list, the existing value will be converted into a list with the new values prepended.

Declared In

AMPIdentify.h

– set:value:

Sets the value of a given user property. If the value already exists, it will be overwritten with the new value.

- (AMPIdentify *)set:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to set.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Sets the value of a given user property. If the value already exists, it will be overwritten with the new value.

Declared In

AMPIdentify.h

– setOnce:value:

Sets the value of a given user property only once. Subsequent setOnce operations on that user property will be ignored; however, that user property can still be modified through any of the other operations.

- (AMPIdentify *)setOnce:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to set once.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Sets the value of a given user property only once. Subsequent setOnce operations on that user property will be ignored; however, that user property can still be modified through any of the other operations.

This is useful for capturing properties such as initial_signup_date, initial_referrer, etc.

Declared In

AMPIdentify.h

– unset:

Unset and remove user property. This user property will no longer show up in that user’s profile.

- (AMPIdentify *)unset:(NSString *)property

Parameters

property

The user property key to unset.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Unset and remove user property. This user property will no longer show up in that user’s profile.

Declared In

AMPIdentify.h

– preInsert:value:

Pre-insert the value of a given user property. If the value already exists, it will do no operation.

- (AMPIdentify *)preInsert:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to set.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Pre-insert the value of a given user property. If the value already exists, it will do no operation.

Declared In

AMPIdentify.h

– postInsert:value:

Post-insert the value of a given user property. If the value already exists, it will do no operation.

- (AMPIdentify *)postInsert:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to set.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Post-insert the value of a given user property. If the value already exists, it will do no operation.

Declared In

AMPIdentify.h

– remove:value:

Remove the value of a given user property, if the value exists. If the value doesn’t exsit, it will do no opearation.

- (AMPIdentify *)remove:(NSString *)property value:(NSObject *)value

Parameters

property

The user property key

value

A value or values to set.

Return Value

the same AMPIdentify object, allowing you to chain multiple method calls together.

Discussion

Remove the value of a given user property, if the value exists. If the value doesn’t exsit, it will do no opearation.

Declared In

AMPIdentify.h