People

open class People

Access to the Mixpanel People API, available as an accessible variable from the main Mixpanel instance.

  • controls the $ignore_time property in any subsequent MixpanelPeople operation. 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

    Declaration

    Swift

    open var ignoreTime = false
  • Register the given device to receive push notifications.

    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 Data token passed to application:didRegisterForRemoteNotificationsWithDeviceToken:.

    Declaration

    Swift

    open func addPushDeviceToken(_ deviceToken: Data)

    Parameters

    deviceToken

    device token as returned from application:didRegisterForRemoteNotificationsWithDeviceToken:

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

    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.

    Declaration

    Swift

    open func removePushDeviceToken(_ deviceToken: Data)

    Parameters

    deviceToken

    device token as returned from application:didRegisterForRemoteNotificationsWithDeviceToken:

  • Set properties on the current user in Mixpanel People.

    The properties will be set on the current user. Property keys must be String objects and the supported value types need to conform to MixpanelType. MixpanelType can be either String, Int, UInt, Double, Float, Bool, [MixpanelType], [String: MixpanelType], Date, URL, or NSNull. You can override 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.

    Precondition

    You must identify for the set information to be linked to that user

    Declaration

    Swift

    open func set(properties: Properties)

    Parameters

    properties

    properties dictionary

  • Convenience method for setting a single property in Mixpanel People.

    Property keys must be String objects and the supported value types need to conform to MixpanelType. MixpanelType can be either String, Int, UInt, Double, Float, Bool, [MixpanelType], [String: MixpanelType], Date, URL, or NSNull.

    Declaration

    Swift

    open func set(property: String, to: MixpanelType)

    Parameters

    property

    property name

    to

    property value

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

    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.

    Declaration

    Swift

    open func setOnce(properties: Properties)

    Parameters

    properties

    properties dictionary

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

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

    Declaration

    Swift

    open func unset(properties: [String])

    Parameters

    properties

    properties array

  • Increment the given numeric properties by the given values.

    Property keys must be String 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 number objects.

    Declaration

    Swift

    open func increment(properties: Properties)

    Parameters

    properties

    properties array

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

    Declaration

    Swift

    open func increment(property: String, by: Double)

    Parameters

    property

    property name

    by

    amount to increment by

  • Append values to list properties.

    Property keys must be String objects and the supported value types need to conform to MixpanelType. MixpanelType can be either String, Int, UInt, Double, Float, Bool, [MixpanelType], [String: MixpanelType], Date, URL, or NSNull.

    Declaration

    Swift

    open func append(properties: Properties)

    Parameters

    properties

    mapping of list property names to values to append

  • Removes list properties.

    Property keys must be String objects and the supported value types need to conform to MixpanelType. MixpanelType can be either String, Int, UInt, Double, Float, Bool, [MixpanelType], [String: MixpanelType], Date, URL, or NSNull.

    Declaration

    Swift

    open func remove(properties: Properties)

    Parameters

    properties

    mapping of list property names to values to remove

  • Union list properties.

    Property values must be array objects.

    Declaration

    Swift

    open func union(properties: Properties)

    Parameters

    properties

    mapping of list property names to lists to union

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

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

    Declaration

    Swift

    open func trackCharge(amount: Double, properties: Properties? = nil)

    Parameters

    amount

    amount of revenue received

    properties

    Optional. properties dictionary

  • Delete current user’s revenue history.

    Declaration

    Swift

    open func clearCharges()
  • Delete current user’s record from Mixpanel People.

    Declaration

    Swift

    open func deleteUser()