mixpanel-react-native
Version:
Official React Native Tracking Library for Mixpanel Analytics
4,466 lines (1,019 loc) • 50.8 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Mixpanel</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Mixpanel</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Mixpanel<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">The primary class for integrating Mixpanel with your app.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Mixpanel"><span class="type-signature"></span>new Mixpanel<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line39">line 39</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="Mixpanel.html">Mixpanel</a></dt>
<dd></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".init"><span class="type-signature">(async, static) </span>init<span class="signature">(token, trackAutomaticEvents, Optional)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>token</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">your project token.</td>
</tr>
<tr>
<td class="name"><code>trackAutomaticEvents</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">Whether or not to automatically track common mobile events</td>
</tr>
<tr>
<td class="name"><code>Optional</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">Whether or not Mixpanel can start tracking by default. See optOutTracking()</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>since version 1.3.0. To initialize Mixpanel, please use the instance method `init` instead. See the example below:
<pre><code>
const trackAutomaticEvents = true;
const mixpanel = new Mixpanel('your project token', trackAutomaticEvents);
mixpanel.init();
</code></pre>
Initializes Mixpanel and return an instance of Mixpanel the given project token.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line100">line 100</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addGroup"><span class="type-signature"></span>addGroup<span class="signature">(groupKey, groupID)</span><span class="type-signature"></span></h4>
<div class="description">
Add a group to this user's membership for a particular group key
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>groupKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The property name associated with this group type (must already have been set up).</td>
</tr>
<tr>
<td class="name"><code>groupID</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The new group the user belongs to.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line389">line 389</a>
</li></ul></dd>
</dl>
<h4 class="name" id="alias"><span class="type-signature"></span>alias<span class="signature">(alias, distinctId)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>alias</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">A unique identifier that you want to use as an identifier for this user.</td>
</tr>
<tr>
<td class="name"><code>distinctId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the current distinct_id that alias will be mapped to.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>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)`
<p>This call does not identify the user after. You must still call identify()
if you wish the new alias to be used for Events and People.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line264">line 264</a>
</li></ul></dd>
</dl>
<h4 class="name" id="clearSuperProperties"><span class="type-signature"></span>clearSuperProperties<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Erase all currently registered superProperties.
<p>Future tracking calls to Mixpanel will not contain the specific
superProperties registered before the clearSuperProperties method was called.
<p>To remove a single superProperty, use unregisterSuperProperty()
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line497">line 497</a>
</li></ul></dd>
</dl>
<h4 class="name" id="deleteGroup"><span class="type-signature"></span>deleteGroup<span class="signature">(groupKey, groupID)</span><span class="type-signature"></span></h4>
<div class="description">
Permanently deletes this group's record from Group Analytics.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>groupKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">String identifying the type of group (must be already in use as a group key)</td>
</tr>
<tr>
<td class="name"><code>groupID</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Object identifying the specific group
<p>Calling deleteGroup deletes an entire record completely. Any future calls
to Group Analytics using the same group value will create and store new values.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line417">line 417</a>
</li></ul></dd>
</dl>
<h4 class="name" id="eventElapsedTime"><span class="type-signature"></span>eventElapsedTime<span class="signature">(eventName)</span><span class="type-signature"> → {Promise.<number>}</span></h4>
<div class="description">
Retrieves the time elapsed for the named event since timeEvent() was called.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>eventName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the name of the event to be tracked that was previously called with timeEvent()</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line522">line 522</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Time elapsed since timeEvent(String) was called for the given eventName.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<number></span>
</dd>
</dl>
<h4 class="name" id="flush"><span class="type-signature"></span>flush<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Push all queued Mixpanel events and People Analytics changes to Mixpanel servers.
<p>Events and People messages are pushed gradually throughout
the lifetime of your application. This means that to ensure that all messages
are sent to Mixpanel when your application is shut down, you will
need to call flush() to let the Mixpanel library know it should
send all remaining messages to the server.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line582">line 582</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getDeviceId"><span class="type-signature"></span>getDeviceId<span class="signature">()</span><span class="type-signature"> → {Promise.<string>}</span></h4>
<div class="description">
Returns the current device id of the device.
This id automatically generated by the library and regenerated when logout or reset is called.
example of usage:
<pre>
<code>
const deviceId = await mixpanel.getDeviceId();
</code>
</pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line569">line 569</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A Promise to the device id
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<string></span>
</dd>
</dl>
<h4 class="name" id="getDistinctId"><span class="type-signature"></span>getDistinctId<span class="signature">()</span><span class="type-signature"> → {Promise.<string>}</span></h4>
<div class="description">
Returns the current distinct id of the user.
This is either the id automatically generated by the library or the id that has been passed by a call to identify().
example of usage:
<pre>
<code>
const distinctId = await mixpanel.getDistinctId();
</code>
</pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line551">line 551</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A Promise to the distinct id associated with Mixpanel event and People Analytics
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<string></span>
</dd>
</dl>
<h4 class="name" id="getGroup"><span class="type-signature"></span>getGroup<span class="signature">(groupKey, groupID)</span><span class="type-signature"></span></h4>
<div class="description">
Returns a MixpanelGroup object that can be used to set and increment
Group Analytics properties.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>groupKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">String identifying the type of group (must be already in use as a group key)</td>
</tr>
<tr>
<td class="name"><code>groupID</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Object identifying the specific group</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line369">line 369</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
an instance of MixpanelGroup that you can use to update
records in Mixpanel Group Analytics
</div>
<h4 class="name" id="getPeople"><span class="type-signature"></span>getPeople<span class="signature">()</span><span class="type-signature"> → {<a href="People.html">People</a>}</span></h4>
<div class="description">
Returns a Mixpanel People object that can be used to set and increment
People Analytics properties.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line306">line 306</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
an instance of People that you can use to update
records in Mixpanel People Analytics
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="People.html">People</a></span>
</dd>
</dl>
<h4 class="name" id="getSuperProperties"><span class="type-signature"></span>getSuperProperties<span class="signature">()</span><span class="type-signature"> → {Promise.<object>}</span></h4>
<div class="description">
Returns a json object of the user's current super properties
<p>SuperProperties are a collection of properties that will be sent with every event to Mixpanel,
and persist beyond the lifetime of your application.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line485">line 485</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Super properties for this Mixpanel instance.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<object></span>
</dd>
</dl>
<h4 class="name" id="hasOptedOutTracking"><span class="type-signature"></span>hasOptedOutTracking<span class="signature">()</span><span class="type-signature"> → {Promise.<boolean>}</span></h4>
<div class="description">
Will return true if the user has opted out from tracking.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line189">line 189</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true if user has opted out from tracking. Defaults to false.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<boolean></span>
</dd>
</dl>
<h4 class="name" id="identify"><span class="type-signature"></span>identify<span class="signature">(distinctId)</span><span class="type-signature"> → {Promise}</span></h4>
<div class="description">
Associate all future calls to track() with the user identified by
the given distinct id.
<p>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.
<p>Once identify is called, the local distinct id persists across restarts of
your application.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>distinctId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">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.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line234">line 234</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A promise that resolves when the identify is successful.
It does not return any value.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="init"><span class="type-signature">(async) </span>init<span class="signature">(optOutTrackingDefault, superProperties, serverURL)</span><span class="type-signature"></span></h4>
<div class="description">
Initializes Mixpanel
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>optOutTrackingDefault</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="default">
</td>
<td class="description last">Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()</td>
</tr>
<tr>
<td class="name"><code>superProperties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="default">
</td>
<td class="description last">Optional A Map containing the key value pairs of the super properties to register</td>
</tr>
<tr>
<td class="name"><code>serverURL</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
https://api.mixpanel.com
</td>
<td class="description last">Optional Set the base URL used for Mixpanel API requests. See setServerURL()</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line70">line 70</a>
</li></ul></dd>
</dl>
<h4 class="name" id="optInTracking"><span class="type-signature"></span>optInTracking<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
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.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line199">line 199</a>
</li></ul></dd>
</dl>
<h4 class="name" id="optOutTracking"><span class="type-signature"></span>optOutTracking<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
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.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line210">line 210</a>
</li></ul></dd>
</dl>
<h4 class="name" id="registerSuperProperties"><span class="type-signature"></span>registerSuperProperties<span class="signature">(properties)</span><span class="type-signature"></span></h4>
<div class="description">
Register properties that will be sent with every subsequent call to track().
<p>SuperProperties are a collection of properties that will be sent with every event to Mixpanel,
and persist beyond the lifetime of your application.
<p>Setting a superProperty with registerSuperProperties will store a new superProperty,
possibly overwriting any existing superProperty with the same name (to set a
superProperty only if it is currently unset, use registerSuperPropertiesOnce())
<p>SuperProperties will persist even if your application is taken completely out of memory.
to remove a superProperty, call unregisterSuperProperty() or clearSuperProperties()
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>properties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Map containing super properties to register</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line439">line 439</a>
</li></ul></dd>
</dl>
<h4 class="name" id="registerSuperPropertiesOnce"><span class="type-signature"></span>registerSuperPropertiesOnce<span class="signature">(properties)</span><span class="type-signature"></span></h4>
<div class="description">
Register super properties for events, only if no other super property with the
same names has already been registered.
<p>Calling registerSuperPropertiesOnce will never overwrite existing properties.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>properties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Map containing the super properties to register.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line454">line 454</a>
</li></ul></dd>
</dl>
<h4 class="name" id="removeGroup"><span class="type-signature"></span>removeGroup<span class="signature">(groupKey, groupID)</span><span class="type-signature"></span></h4>
<div class="description">
Remove a group from this user's membership for a particular group key
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>groupKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The property name associated with this group type (must already have been set up).</td>
</tr>
<tr>
<td class="name"><code>groupID</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The group value to remove.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line402">line 402</a>
</li></ul></dd>
</dl>
<h4 class="name" id="reset"><span class="type-signature"></span>reset<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Clear super properties and generates a new random distinctId for this instance.
Useful for clearing data when a user logs out.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line533">line 533</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setFlushBatchSize"><span class="type-signature"></span>setFlushBatchSize<span class="signature">(flushBatchSize)</span><span class="type-signature"></span></h4>
<div class="description">
Set the number of events sent in a single network request to the Mixpanel server.
By configuring this value, you can optimize network usage and manage the frequency of communication between the client and the server. The maximum size is 50; any value over 50 will default to 50.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>flushBatchSize</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">whether to automatically send the client IP Address.
Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line180">line 180</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setFlushOnBackground"><span class="type-signature"></span>setFlushOnBackground<span class="signature">(flushOnBackground)</span><span class="type-signature"></span></h4>
<div class="description">
This allows enabling or disabling whether or not Mixpanel flushes events
when the app enters the background on iOS. This is set to true by default.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>flushOnBackground</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">whether to enable logging</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line146">line 146</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setGroup"><span class="type-signature"></span>setGroup<span class="signature">(groupKey, groupID)</span><span class="type-signature"></span></h4>
<div class="description">
Set the group this user belongs to.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>groupKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The property name associated with this group type (must already have been set up).</td>
</tr>
<tr>
<td class="name"><code>groupID</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The group the user belongs to.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line353">line 353</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setLoggingEnabled"><span class="type-signature"></span>setLoggingEnabled<span class="signature">(loggingEnabled)</span><span class="type-signature"></span></h4>
<div class="description">
This allows enabling or disabling of all Mixpanel logs at run time.
All logging is disabled by default. Usually, this is only required if
you are running into issues with the SDK that you want to debug
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>loggingEnabled</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">whether to enable logging</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line135">line 135</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setServerURL"><span class="type-signature"></span>setServerURL<span class="signature">(serverURL)</span><span class="type-signature"></span></h4>
<div class="description">
Set the base URL used for Mixpanel API requests.
Useful if you need to proxy Mixpanel requests. Defaults to https://api.mixpanel.com.
To route data to Mixpanel's EU servers, set to https://api-eu.mixpanel.com
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>serverURL</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the base URL used for Mixpanel API requests</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line123">line 123</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setUseIpAddressForGeolocation"><span class="type-signature"></span>setUseIpAddressForGeolocation<span class="signature">(useIpAddressForGeolocation)</span><span class="type-signature"></span></h4>
<div class="description">
This controls whether to automatically send the client IP Address as part of event tracking.
With an IP address, geo-location is possible down to neighborhoods within a city,
although the Mixpanel Dashboard will just show you city level location specificity.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>useIpAddressForGeolocation</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">whether to automatically send the client IP Address.
Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line165">line 165</a>
</li></ul></dd>
</dl>
<h4 class="name" id="timeEvent"><span class="type-signature"></span>timeEvent<span class="signature">(eventName)</span><span class="type-signature"></span></h4>
<div class="description">
Begin timing of an event. Calling timeEvent("Thing") will not send an event, but
when you eventually call track("Thing"), your tracked event will be sent with a "$duration"
property, representing the number of seconds between your calls.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>eventName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the name of the event to track with timing.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line508">line 508</a>
</li></ul></dd>
</dl>
<h4 class="name" id="track"><span class="type-signature"></span>track<span class="signature">(eventName, properties)</span><span class="type-signature"></span></h4>
<div class="description">
Track an event.
<p>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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>eventName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the event to send</td>
</tr>
<tr>
<td class="name"><code>properties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Map containing the key value pairs of the properties to include in this event.
Pass null if no extra properties exist.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line286">line 286</a>
</li></ul></dd>
</dl>
<h4 class="name" id="trackWithGroups"><span class="type-signature"></span>trackWithGroups<span class="signature">(eventName, properties, groups)</span><span class="type-signature"></span></h4>
<div class="description">
Track an event with specific groups.
<p>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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>eventName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the event to send</td>
</tr>
<tr>
<td class="name"><code>properties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Map containing the key value pairs of the properties to include in this event.
Pass null if no extra properties exist.</td>
</tr>
<tr>
<td class="name"><code>groups</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Map containing the group key value pairs for this event.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line329">line 329</a>
</li></ul></dd>
</dl>
<h4 class="name" id="unregisterSuperProperty"><span class="type-signature"></span>unregisterSuperProperty<span class="signature">(propertyName)</span><span class="type-signature"></span></h4>
<div class="description">
Remove a single superProperty, so that it will not be sent with future calls to track().
<p>If there is a superProperty registered with the given name, it will be permanently
removed from the existing superProperties.
To clear all superProperties, use clearSuperProperties()
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>propertyName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">name of the property to unregister</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"