# Global

##

### Methods

#### addGroup(groupKey, groupID)

Add a group to this user's membership for a particular group key

##### Parameters:

Name | Type | Description
--- | --- | ---
`groupKey` |  | The property name associated with this group type (must already have been set up).
`groupID` |  | The new group the user belongs to.

Source:
  - index.js, line 242

#### alias(alias, distinctId)

The alias method creates an alias which Mixpanel will use to remap one id to another. Multiple aliases can point to the same identifier. `mixpane.alias("New ID", mixpane.distinctId)` `mixpane.alias("Newer ID", mixpane.distinctId)`

This call does not identify the user after. You must still call both identify() and People.identify() if you wish the new alias to be used for Events and People.

##### Parameters:

Name | Type | Description
--- | --- | ---
`alias` |  | A unique identifier that you want to use as an identifier for this user.
`distinctId` |  | the current distinct_id that alias will be mapped to.

Source:
  - index.js, line 138

#### clearSuperProperties()

Clear all currently set super properties.

Source:
  - index.js, line 321

#### deleteGroup(groupKey, groupID)

Permanently deletes this group's record from Group Analytics.

##### Parameters:

Name | Type | Description
--- | --- | ---
`groupKey` |  | String identifying the type of group (must be already in use as a group key)
`groupID` |  | Object identifying the specific group Calling deleteGroup deletes an entire record completely. Any future calls to Group Analytics using the same group value will create and store new values.

Source:
  - index.js, line 272

#### eventElapsedTime()

Retrieve the time elapsed for the named event since timeEvent(eventName) was called.

Source:
  - index.js, line 340

#### flush()

Upload queued data to the Mixpanel server.

Source:
  - index.js, line 366

#### getDistinctId()

Returns the string id currently being used to uniquely identify the user associated with events.

Source:
  - index.js, line 359

#### getGroup(groupKey, groupID)

Returns a MixpanelGroup object that can be used to set and increment Group Analytics properties.

##### Parameters:

Name | Type | Description
--- | --- | ---
`groupKey` |  | String identifying the type of group (must be already in use as a group key)
`groupID` |  | Object identifying the specific group

Source:
  - index.js, line 232

##### Returns:

an instance of MixpanelGroup that you can use to update records in Mixpanel Group Analytics

#### getPeople()

Returns a Mixpanel People object that can be used to set and increment People Analytics properties.

Source:
  - index.js, line 179

##### Returns:

an instance of People that you can use to update records in Mixpanel People Analytics

#### getSuperProperties()

Get current user super property.

Source:
  - index.js, line 314

#### hasOptedOutTracking()

Will return true if the user has opted out from tracking.

Source:
  - index.js, line 75

##### Returns:

true if user has opted out from tracking. Defaults to false.

#### identify(distinctId)

Associate all future calls to track() with the user identified by the given distinct id.

Calls to track() made before corresponding calls to identify will use an anonymous locally generated distinct id, which means it is best to call identify early to ensure that your Mixpanel funnels and retention analytics can continue to track the user throughout their lifetime. We recommend calling identify when the user authenticates.

Once identify is called, the local distinct id persists across restarts of your application.

##### Parameters:

Name | Type | Description
--- | --- | ---
`distinctId` |  | a string uniquely identifying this user. Events sent to Mixpanel using the same disinct_id will be considered associated with the same visitor/customer for retention and funnel reporting, so be sure that the given value is globally unique for each individual user you intend to track.

Source:
  - index.js, line 118

#### (async) init(token, optOutTrackingDefault)

Initializes an instance of the API with the given project token.

##### Parameters:

Name | Type | Description
--- | --- | ---
`token` |  | your project token.
`optOutTrackingDefault` |  | Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()

Source:
  - index.js, line 64

#### optInTracking()

Use this method to opt-in an already opted-out user from tracking. People updates and track calls will be sent to Mixpanel after using this method. This method will internally track an opt-in event to your project.

Source:
  - index.js, line 85

#### optOutTracking()

Use this method to opt-out a user from tracking. Events and people updates that haven't been flushed yet will be deleted. Use flush() before calling this method if you want to send all the queues to Mixpanel before. This method will also remove any user-related information from the device.

Source:
  - index.js, line 96

#### registerSuperProperties()

Register a set of super properties, which are included with all events. This will overwrite previous super property values.

Source:
  - index.js, line 283

#### registerSuperPropertiesOnce()

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

Source:
  - index.js, line 294

#### removeGroup(groupKey, groupID)

Remove a group from this user's membership for a particular group key

##### Parameters:

Name | Type | Description
--- | --- | ---
`groupKey` |  | The property name associated with this group type (must already have been set up).
`groupID` |  | The group value to remove.

Source:
  - index.js, line 256

#### reset()

Clear super properties and generates a new random distinctId for this instance. Useful for clearing data when a user logs out.

Source:
  - index.js, line 351

#### setGroup(groupKey, groupID)

Set the group this user belongs to.

##### Parameters:

Name | Type | Description
--- | --- | ---
`groupKey` |  | The property name associated with this group type (must already have been set up).
`groupID` |  | The group the user belongs to.

Source:
  - index.js, line 215

#### timeEvent()

Use to calculate time required for an event by including the time between this call and a later 'track' call for the same event in the properties sent with the event.

Source:
  - index.js, line 330

#### track(eventName, properties)

Track an event.

Every call to track eventually results in a data point sent to Mixpanel. These data points are what are measured, counted, and broken down to create your Mixpanel reports. Events have a string name, and an optional set of name/value pairs that describe the properties of that event.

##### Parameters:

Name | Type | Description
--- | --- | ---
`eventName` |  | The name of the event to send
`properties` |  | A Map containing the key value pairs of the properties to include in this event. Pass null if no extra properties exist.

Source:
  - index.js, line 161

#### trackWithGroups(eventName, properties, groups)

Track an event with specific groups.

Every call to track eventually results in a data point sent to Mixpanel. These data points are what are measured, counted, and broken down to create your Mixpanel reports. Events have a string name, and an optional set of name/value pairs that describe the properties of that event. Group key/value pairs are upserted into the property map before tracking.

##### Parameters:

Name | Type | Description
--- | --- | ---
`eventName` |  | The name of the event to send
`properties` |  | A Map containing the key value pairs of the properties to include in this event. Pass null if no extra properties exist.
`groups` |  | A Map containing the group key value pairs for this event. See also org.json.JSONObject), Map)

Source:
  - index.js, line 198

#### unregisterSuperProperty()

Delete a super property stored with the current user.

Source:
  - index.js, line 304