Packagecom.mixpanel
Classpublic class Mixpanel
InheritanceMixpanel Inheritance Object

Mixpanel AS3 API

Version 2.2.1



Public Methods
 MethodDefined By
  
Mixpanel(token:String)
Create an instance of the Mixpanel library
Mixpanel
  
disable(events:Array = null):void
Disable events on the Mixpanel object.
Mixpanel
  
Get the unique ID assigned to the user.
Mixpanel
  
get_property(property:String):*
Get the value of a super property by the property name.
Mixpanel
  
identify(uniqueID:String):void
Identify a user with a unique id.
Mixpanel
  
name_tag(name:String):void
Provide a string to recognize the user by.
Mixpanel
  
people_clear_charges(... args):Object
Clear all the current user's transactions.
Mixpanel
  
people_delete(... args):Object
delete the current user record (using current distinct_id) Usage: mixpanel.people_delete();
Mixpanel
  
people_increment(... args):Object
Increment/decrement properties on a user record Usage: mixpanel.people_increment('page_views', 1); // or, for convienience, if you're just incrementing a counter by 1, you can // simply do mixpanel.people_increment('page_views'); // to decrement a counter, pass a negative number mixpanel.people.increment('credits_left', -1); // like mixpanel.people_set(), you can increment multiple properties at once: mixpanel.people.increment({ 'counter1': '1', 'counter2': '3' });
Mixpanel
  
people_set(... args):Object
Set properties on a user record Usage: mixpanel.people_set('gender', 'm'); mixpanel.people.set({ 'company': 'Acme', 'plan': 'free' }); // properties can be strings, integers or dates
Mixpanel
  
people_track_charge(amount:Number, ... args):Object
Record that you have charged the current user a certain amount of money.
Mixpanel
  
register(properties:Object):void
Register a set of super properties, which are included with all events/funnels.
Mixpanel
  
register_once(properties:Object, defaultValue:* = null):void
Register a set of super properties only once.
Mixpanel
  
set_config(config:Object):void
Update the configuration of a mixpanel library instance.
Mixpanel
  
track(event:String, ... args):Object
Track an event.
Mixpanel
  
unregister(property:String):void
Delete a super property stored with the current user.
Mixpanel
  
Delete all super properties stored for the current user.
Mixpanel
Constructor Detail
Mixpanel()Constructor
public function Mixpanel(token:String)

Create an instance of the Mixpanel library

Parameters
token:String — your Mixpanel API token
Method Detail
disable()method
public function disable(events:Array = null):void

Disable events on the Mixpanel object. If passed no arguments, this function disables tracking of any event. If passed an array of event names, those events will be disabled, but other events will continue to be tracked.

Note: this function doesn't stop regular mixpanel functions from firing such as register and name_tag.

Parameters

events:Array (default = null) — A array of event names to disable

get_distinct_id()method 
public function get_distinct_id():String

Get the unique ID assigned to the user. This ID is automatically assigned unless you specify your own via identify().

Returns
String — the current distinct_id
get_property()method 
public function get_property(property:String):*

Get the value of a super property by the property name.

Parameters

property:String — the name of the super property to retrieve

Returns
* — the value of the super property
identify()method 
public function identify(uniqueID:String):void

Identify a user with a unique id. All subsequent actions caused by this user will be tied to this identity. This property is used to track unique visitors. If the method is never called, then unique visitors will be identified by a UUID generated the first time they visit the site.

Parameters

uniqueID:String — A string that uniquely identifies the user

name_tag()method 
public function name_tag(name:String):void

Provide a string to recognize the user by. The string passed to this method will appear in the Mixpanel Streams product rather than an automatically generated name. Name tags do not have to be unique.

Parameters

name:String — A human readable name for the user

people_clear_charges()method 
public function people_clear_charges(... args):Object

Clear all the current user's transactions.

Usage:

		 		mixpanel.people_clear_charges();
		 

Parameters

... args

Returns
Object
people_delete()method 
public function people_delete(... args):Object

delete the current user record (using current distinct_id)

Usage:

		 		mixpanel.people_delete();
		 

Parameters

... args

Returns
Object
people_increment()method 
public function people_increment(... args):Object

Increment/decrement properties on a user record

Usage:

		 		mixpanel.people_increment('page_views', 1);
		 
		 		// or, for convienience, if you're just incrementing a counter by 1, you can
		 		// simply do
		 		mixpanel.people_increment('page_views');
		 
		 		// to decrement a counter, pass a negative number
		 		mixpanel.people.increment('credits_left', -1);
		 
		 		// like mixpanel.people_set(), you can increment multiple properties at once:
		 		mixpanel.people.increment({
		 			'counter1': '1',
		 			'counter2': '3'
		 		});
		 

Parameters

... args

Returns
Object
people_set()method 
public function people_set(... args):Object

Set properties on a user record

Usage:

		 		mixpanel.people_set('gender', 'm');
		 
		 		mixpanel.people.set({
		 			'company': 'Acme',
		 			'plan': 'free'
		 		});
		 
		 		// properties can be strings, integers or dates
		 

Parameters

... args

Returns
Object
people_track_charge()method 
public function people_track_charge(amount:Number, ... args):Object

Record that you have charged the current user a certain amount of money.

Usage:

		 		// charge a user $29.99
		 		mixpanel.people_track_charge(29.99);
		 
		 		// charge a user $10 on the 2nd of January
		 	    // Note: $time must be a valid ISO datetime string
		 		mixpanel.people_track_charge(10, { '$time': '2012-01-02T00:00:00' });
		 

Parameters

amount:Number
 
... args

Returns
Object
register()method 
public function register(properties:Object):void

Register a set of super properties, which are included with all events/funnels. This will overwrite previous super property values. It is mutable unlike register_once.

Parameters

properties:Object — Associative array of properties to store about the user

register_once()method 
public function register_once(properties:Object, defaultValue:* = null):void

Register a set of super properties only once. This will not overwrite previous super property values, unlike register(). It's basically immutable.

Parameters

properties:Object — Associative array of properties to store about the user
 
defaultValue:* (default = null) — Value to override if already set in super properties (ex: "False")

set_config()method 
public function set_config(config:Object):void

Update the configuration of a mixpanel library instance.

The default config is:

		 {
		     // super properties span subdomains
		     crossSubdomainStorage: true,
		 
		     // enable test in development mode
		     test: false,
		 		 	   // enable longer, debug-friendly api responses
		     verbose: false,
		 		     // Method to use when sending Mixpanel HTTP API requests,
		     // should be either URLRequestMethod.GET or URLRequestMethod.POST
		     request_method: URLRequestMethod.GET
		 };
		 

Parameters

config:Object — A dictionary of new configuration values to update

track()method 
public function track(event:String, ... args):Object

Track an event. This is the most important Mixpanel function and the one you will be using the most

Parameters

event:String — the name of the event
 
... args — if the first arg in args is an object, it will be used as the properties object. The last argument is a callback function. The callback and properties arguments are both optional.

Returns
Object — the data sent to the server
unregister()method 
public function unregister(property:String):void

Delete a super property stored with the current user.

Parameters

property:String — the name of the super property to remove

unregister_all()method 
public function unregister_all():void

Delete all super properties stored for the current user.

THIS IS UNREVERSABLE! Be careful.