MixpanelPeople Class Reference

Inherits from NSObject
Declared in MixpanelPeople.h

Overview

Mixpanel People API.

Access to the Mixpanel People API, available as a property on the main Mixpanel API.

You should not instantiate this object yourself. An instance of it will be available as a property of the main Mixpanel object. Calls to Mixpanel People methods will look like this:

[mixpanel.people increment:@"App Opens" by:[NSNumber numberWithInt:1]];

Please note that the core Mixpanel and MixpanelPeople classes share the identify: method. The Mixpanel identify: affects the distinct_id property of events sent by track: and track:properties: and determines which Mixpanel People user record will be updated by set:, increment: and other MixpanelPeople methods.

If you are going to set your own distinct IDs for core Mixpanel event tracking, make sure to use the same distinct IDs when using Mixpanel People.

  ignoreTime

controls the $ignore_time property in any subsequent MixpanelPeople operation.

@property (atomic) BOOL ignoreTime

Discussion

If the $ignore_time property is present and true in your request, Mixpanel will not automatically update the “Last Seen” property of the profile. Otherwise, Mixpanel will add a “Last Seen” property associated with the current time for all $set, $append, and $add operations

Defaults to NO.

Declared In

MixpanelPeople.h

– addPushDeviceToken:

Register the given device to receive push notifications.

- (void)addPushDeviceToken:(NSData *)deviceToken

Parameters

deviceToken

device token as returned application:didRegisterForRemoteNotificationsWithDeviceToken:

Discussion

This will associate the device token with the current user in Mixpanel People, which will allow you to send push notifications to the user from the Mixpanel People web interface. You should call this method with the NSData token passed to application:didRegisterForRemoteNotificationsWithDeviceToken:.

Declared In

MixpanelPeople.h

– removeAllPushDeviceTokens

Unregister the given device to receive push notifications.

- (void)removeAllPushDeviceTokens

Discussion

This will unset all of the push tokens saved to this people profile. This is useful in conjunction with a call to reset, or when a user is logging out.

Declared In

MixpanelPeople.h

– removePushDeviceToken:

Unregister a specific device token from the ability to receive push notifications.

- (void)removePushDeviceToken:(NSData *)deviceToken

Parameters

deviceToken

device token to be unregistered

Discussion

This will remove the provided push token saved to this people profile. This is useful in conjunction with a call to reset, or when a user is logging out.

Declared In

MixpanelPeople.h

– set:

Set properties on the current user in Mixpanel People.

- (void)set:(NSDictionary *)properties

Parameters

properties

properties dictionary

Discussion

The properties will be set on the current user. The keys must be NSString objects and the values should be NSString, NSNumber, NSArray, NSDate, or NSNull objects. We use an NSAssert to enforce this type requirement. In release mode, the assert is stripped out and we will silently convert incorrect types to strings using [NSString stringWithFormat:@“%@”, value]. You can override the default the current project token and distinct ID by including the special properties: $token and $distinct_id. If the existing user record on the server already has a value for a given property, the old value is overwritten. Other existing properties will not be affected.

// applies to both Mixpanel Engagement track: AND Mixpanel People set: and
// increment: calls
[mixpanel identify:distinctId];

Declared In

MixpanelPeople.h

– set:to:

Convenience method for setting a single property in Mixpanel People.

- (void)set:(NSString *)property to:(id)object

Parameters

property

property name

object

property value

Discussion

Property keys must be NSString objects and values must be NSString, NSNumber, NSNull, NSArray, NSDictionary, NSDate or NSURL objects.

Declared In

MixpanelPeople.h

– setOnce:

Set properties on the current user in Mixpanel People, but don’t overwrite if there is an existing value.

- (void)setOnce:(NSDictionary *)properties

Parameters

properties

properties dictionary

Discussion

This method is identical to set: except it will only set properties that are not already set. It is particularly useful for collecting data about the user’s initial experience and source, as well as dates representing the first time something happened.

Declared In

MixpanelPeople.h

– unset:

Remove a list of properties and their values from the current user’s profile in Mixpanel People.

- (void)unset:(NSArray *)properties

Parameters

properties

properties array

Discussion

The properties array must ony contain NSString names of properties. For properties that don’t exist there will be no effect.

Declared In

MixpanelPeople.h

– increment:

Increment the given numeric properties by the given values.

- (void)increment:(NSDictionary *)properties

Parameters

properties

properties dictionary

Discussion

Property keys must be NSString names of numeric properties. A property is numeric if its current value is a number. If a property does not exist, it will be set to the increment amount. Property values must be NSNumber objects.

Declared In

MixpanelPeople.h

– increment:by:

Convenience method for incrementing a single numeric property by the specified amount.

- (void)increment:(NSString *)property by:(NSNumber *)amount

Parameters

property

property name

amount

amount to increment by

Declared In

MixpanelPeople.h

– append:

Append values to list properties.

- (void)append:(NSDictionary *)properties

Parameters

properties

mapping of list property names to values to append

Discussion

Property keys must be NSString objects and values must be NSString, NSNumber, NSNull, NSArray, NSDictionary, NSDate or NSURL objects.

Declared In

MixpanelPeople.h

– union:

Union list properties.

- (void)union:(NSDictionary *)properties

Parameters

properties

mapping of list property names to lists to union

Discussion

Property keys must be NSArray objects.

Declared In

MixpanelPeople.h

– remove:

Remove list properties.

- (void)remove:(NSDictionary *)properties

Parameters

properties

mapping of list property names to values to remove

Discussion

Property keys must be NSString objects and values must be NSString, NSNumber, NSNull, NSArray, NSDictionary, NSDate or NSURL objects.

Declared In

MixpanelPeople.h

– trackCharge:

Track money spent by the current user for revenue analytics.

- (void)trackCharge:(NSNumber *)amount

Parameters

amount

amount of revenue received

Declared In

MixpanelPeople.h

– trackCharge:withProperties:

Track money spent by the current user for revenue analytics and associate properties with the charge.

- (void)trackCharge:(NSNumber *)amount withProperties:(nullable NSDictionary *)properties

Discussion

Charge properties allow you segment on types of revenue. For instance, you could record a product ID with each charge so that you could segment on it in revenue analytics to see which products are generating the most revenue.

Declared In

MixpanelPeople.h

– clearCharges

Delete current user’s revenue history.

- (void)clearCharges

Declared In

MixpanelPeople.h

– deleteUser

Delete current user’s record from Mixpanel People.

- (void)deleteUser

Declared In

MixpanelPeople.h