MixpanelAPI

Superclass:
NSObject
Declared In:

Introduction

Main entry point for the Mixpanel API.

Discussion

With MixpanelAPI you can log events and analyze funnels using the Mixpanel dashboard.



Methods

-flush

Uploads datapoints to the Mixpanel Server.

-identifyUser:

Identifies a user.

-registerSuperProperties:

Registers a set of super properties for all event types.

-registerSuperPropertiesOnce:

Registers a set of super properties unless the property already exists.

-registerSuperPropertiesOnce:defaultValue:

Registers a set of super properties without overwriting existing values unless the existing value is equal to defaultValue.

+sharedAPI

Returns the shared API object.

+sharedAPIWithToken:

Initializes the API with your API Token. Returns the shared API object.

-track:

Tracks an event.

-track:properties:

Tracks an event with properties.


flush


Uploads datapoints to the Mixpanel Server.

- (void)flush; 
Discussion

Uploads datapoints to the Mixpanel Server.


identifyUser:


Identifies a user.

- (void)identifyUser:(NSString*) identity; 
Parameters
identity

A string to use as a user identity.

Discussion

Identifies a user throughout an application run. By default the UDID of the device is used as an identifier. The API must be initialized with sharedAPIWithToken: before calling this method.


registerSuperProperties:


Registers a set of super properties for all event types.

- (void)registerSuperProperties:(NSDictionary*) properties; 
Parameters
properties

a NSDictionary with the super properties to register. properties that will be registered with both events and funnels.

Discussion

Registers a set of super properties, overwriting property values if they already exist. Super properties are added to all the data points. The API must be initialized with sharedAPIWithToken: before calling this method.


registerSuperPropertiesOnce:


Registers a set of super properties unless the property already exists.

- (void)registerSuperPropertiesOnce:(NSDictionary*) properties; 
Parameters
properties

a NSDictionary with the super properties to register. properties that will be registered with both events and funnels.

Discussion

Registers a set of super properties, without overwriting existing key\value pairs. Super properties are added to all the data points. The API must be initialized with sharedAPIWithToken: before calling this method.


registerSuperPropertiesOnce:defaultValue:


Registers a set of super properties without overwriting existing values unless the existing value is equal to defaultValue.

- (void)registerSuperPropertiesOnce:(NSDictionary*) properties 
        defaultValue:(id) defaultValue; 
Parameters
properties

a NSDictionary with the super properties to register.

defaultValue

If an existing property is equal to defaultValue, the value of said property gets updated.

Discussion

Registers a set of super properties, without overwriting existing key\value pairs. If the value of an existing property is equal to defaultValue, then this method will update the value of that property. Super properties are added to all the data points. The API must be initialized with sharedAPIWithToken: before calling this method.


sharedAPI


Returns the shared API object.

+ (id)sharedAPI; 
Discussion

Returns the Singleton instance of the MixpanelAPI class. The API must be initialized with sharedAPIWithToken: before calling this class method.


sharedAPIWithToken:


Initializes the API with your API Token. Returns the shared API object.

+ (id)sharedAPIWithToken:(NSString*)apiToken; 
Parameters
apiToken

Your Mixpanel API token.

Discussion

Initializes the MixpanelAPI object with your authentication token. This must be the first message sent before logging any events since it performs important initializations to the API.


track:


Tracks an event.

- (void)track:(NSString*) event; 
Parameters
event

The event to track.

Discussion

Tracks an event. Super properties of type kMPLibEventTypeAll and kMPLibEventTypeEvent get attached to events. If this event is a funnel step specified by trackFunnel:steps: It will also be tracked as a funnel. The API must be initialized with sharedAPIWithToken: before calling this method.


track:properties:


Tracks an event with properties.

- (void)track:(NSString*) event properties:(NSDictionary*) properties; 
Parameters
event

The event to track. If this event is a funnel step specified by trackFunnel:steps: It will also be tracked as a funnel.

properties

The properties for this event. The keys must be NSString objects and the values should be NSString or NSNumber objects.

Discussion

Tracks an event. The properties of this event are a union of the super properties of type Super properties of type kMPLibEventTypeAll, kMPLibEventTypeEvent and the properties<properties> parameter. The API must be initialized with sharedAPIWithToken: before calling this method.


Properties

flushOnBackground

Flag to flush data when the app goes into the background.

nameTag

The name tag of the current user.

testMode

Whether test mode is on

uploadInterval

The upload interval in seconds.


flushOnBackground


Flag to flush data when the app goes into the background.

@property(nonatomic,
    assign) BOOL flushOnBackground; 
Discussion

Changes the flushing behavior of the library. If set to NO, the The library will not flush the data points when going into the background. Defaults to YES.


nameTag


The name tag of the current user.

@property(nonatomic,
    retain) NSString *nameTag; 
Discussion

The name tag is a human readable string that identifies the user.


testMode


Whether test mode is on

@property(nonatomic) BOOL testMode; 
Discussion

Changing this value enables/disables test mode for future flushes.


uploadInterval


The upload interval in seconds.

@property(nonatomic,
    assign) NSUInteger uploadInterval; 
Discussion

Changes the interval value. Changing this values resets the update timer with the new interval.