UNPKG

mixpanel-react-native

Version:

Official React Native Tracking Library for Mixpanel Analytics

2,943 lines (576 loc) 31.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</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">Global</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <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"> </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"> </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#line242">line 242</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> <div class="description"> 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 both identify() and People.identify() if you wish the new alias to be used for Events and People. </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>alias</code></td> <td class="type"> </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"> </td> <td class="description last">the current distinct_id that alias will be mapped 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#line138">line 138</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"> Clear all currently set super 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#line321">line 321</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"> </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"> </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#line272">line 272</a> </li></ul></dd> </dl> <h4 class="name" id="eventElapsedTime"><span class="type-signature"></span>eventElapsedTime<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Retrieve the time elapsed for the named event since timeEvent(eventName) was called. </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#line340">line 340</a> </li></ul></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"> Upload queued data to the Mixpanel 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#line366">line 366</a> </li></ul></dd> </dl> <h4 class="name" id="getDistinctId"><span class="type-signature"></span>getDistinctId<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Returns the string id currently being used to uniquely identify the user associated with events. </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#line359">line 359</a> </li></ul></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"> </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"> </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#line232">line 232</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"></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#line179">line 179</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> <h4 class="name" id="getSuperProperties"><span class="type-signature"></span>getSuperProperties<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Get current user super property. </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#line314">line 314</a> </li></ul></dd> </dl> <h4 class="name" id="hasOptedOutTracking"><span class="type-signature"></span>hasOptedOutTracking<span class="signature">()</span><span class="type-signature"></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#line75">line 75</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true if user has opted out from tracking. Defaults to false. </div> <h4 class="name" id="identify"><span class="type-signature"></span>identify<span class="signature">(distinctId)</span><span class="type-signature"></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"> </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#line118">line 118</a> </li></ul></dd> </dl> <h4 class="name" id="init"><span class="type-signature">(async) </span>init<span class="signature">(token, optOutTrackingDefault)</span><span class="type-signature"></span></h4> <div class="description"> Initializes an instance of the API with the given project token. </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>token</code></td> <td class="type"> </td> <td class="description last">your project token.</td> </tr> <tr> <td class="name"><code>optOutTrackingDefault</code></td> <td class="type"> </td> <td class="description last">Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()</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#line64">line 64</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#line85">line 85</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#line96">line 96</a> </li></ul></dd> </dl> <h4 class="name" id="registerSuperProperties"><span class="type-signature"></span>registerSuperProperties<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Register a set of super properties, which are included with all events. This will overwrite previous super property values. </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#line283">line 283</a> </li></ul></dd> </dl> <h4 class="name" id="registerSuperPropertiesOnce"><span class="type-signature"></span>registerSuperPropertiesOnce<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Register a set of super properties only once. This will not overwrite previous super property values, unlike register(). </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#line294">line 294</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"> </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"> </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#line256">line 256</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#line351">line 351</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"> </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"> </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#line215">line 215</a> </li></ul></dd> </dl> <h4 class="name" id="timeEvent"><span class="type-signature"></span>timeEvent<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> 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. </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#line330">line 330</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"> </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"> </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#line161">line 161</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"> </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"> </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"> </td> <td class="description last">A Map containing the group key value pairs for this event. See also org.json.JSONObject), Map)</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#line198">line 198</a> </li></ul></dd> </dl> <h4 class="name" id="unregisterSuperProperty"><span class="type-signature"></span>unregisterSuperProperty<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Delete a super property stored with the current user. </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#line304">line 304</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="MixpanelGroup.html">MixpanelGroup</a></li><li><a href="module.exports.html">exports</a></li><li><a href="People.html">People</a></li></ul><h3>Global</h3><ul><li><a href="global.html#addGroup">addGroup</a></li><li><a href="global.html#alias">alias</a></li><li><a href="global.html#clearSuperProperties">clearSuperProperties</a></li><li><a href="global.html#deleteGroup">deleteGroup</a></li><li><a href="global.html#eventElapsedTime">eventElapsedTime</a></li><li><a href="global.html#flush">flush</a></li><li><a href="global.html#getDistinctId">getDistinctId</a></li><li><a href="global.html#getGroup">getGroup</a></li><li><a href="global.html#getPeople">getPeople</a></li><li><a href="global.html#getSuperProperties">getSuperProperties</a></li><li><a href="global.html#hasOptedOutTracking">hasOptedOutTracking</a></li><li><a href="global.html#identify">identify</a></li><li><a href="global.html#init">init</a></li><li><a href="global.html#optInTracking">optInTracking</a></li><li><a href="global.html#optOutTracking">optOutTracking</a></li><li><a href="global.html#registerSuperProperties">registerSuperProperties</a></li><li><a href="global.html#registerSuperPropertiesOnce">registerSuperPropertiesOnce</a></li><li><a href="global.html#removeGroup">removeGroup</a></li><li><a href="global.html#reset">reset</a></li><li><a href="global.html#setGroup">setGroup</a></li><li><a href="global.html#timeEvent">timeEvent</a></li><li><a href="global.html#track">track</a></li><li><a href="global.html#trackWithGroups">trackWithGroups</a></li><li><a href="global.html#unregisterSuperProperty">unregisterSuperProperty</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Tue Dec 08 2020 12:02:49 GMT-0800 (Pacific Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>