@@ -54,11 +54,12 @@ export class Mixpanel {
5454 * Initializes Mixpanel
5555 *
5656 * @param {boolean } Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
57+ * @param {object } Optional A Map containing the key value pairs of the super properties to register
5758 *
5859 */
59- async init ( optOutTrackingDefault = DEFAULT_OPT_OUT ) {
60+ async init ( optOutTrackingDefault = DEFAULT_OPT_OUT , superProperties = { } ) {
6061 let metadata = Helper . getMetaData ( ) ;
61- await MixpanelReactNative . initialize ( this . token , optOutTrackingDefault , metadata ) ;
62+ await MixpanelReactNative . initialize ( this . token , optOutTrackingDefault , { ... metadata , ... superProperties } ) ;
6263 }
6364
6465 /**
@@ -68,12 +69,12 @@ export class Mixpanel {
6869 * const mixpanel = new Mixpanel('your project token');
6970 * mixpanel.init();
7071 * </code></pre>
71- *
72+ *
7273 * Initializes Mixpanel and return an instance of Mixpanel the given project token.
7374 *
7475 * @param {string } token your project token.
7576 * @param {boolean } Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
76- *
77+ *
7778 */
7879 static async init ( token , optOutTrackingDefault = DEFAULT_OPT_OUT ) {
7980 let metadata = Helper . getMetaData ( ) ;
@@ -87,7 +88,7 @@ export class Mixpanel {
8788 * To route data to Mixpanel's EU servers, set to https://api-eu.mixpanel.com
8889 *
8990 * @param {string } serverURL the base URL used for Mixpanel API requests
90- *
91+ *
9192 */
9293 setServerURL ( serverURL ) {
9394 MixpanelReactNative . setServerURL ( this . token , serverURL ) ;
@@ -96,23 +97,23 @@ export class Mixpanel {
9697 /**
9798 * This allows enabling or disabling of all Mixpanel logs at run time.
9899 * All logging is disabled by default. Usually, this is only required if
99- * you are running into issues with the SDK that you want to debug
100- *
100+ * you are running into issues with the SDK that you want to debug
101+ *
101102 * @param {boolean } loggingEnabled whether to enable logging
102- *
103+ *
103104 */
104105 setLoggingEnabled ( loggingEnabled ) {
105106 MixpanelReactNative . setLoggingEnabled ( this . token , loggingEnabled ) ;
106107 }
107108
108109 /**
109110 * This controls whether to automatically send the client IP Address as part of event tracking.
110- * With an IP address, geo-location is possible down to neighborhoods within a city,
111+ * With an IP address, geo-location is possible down to neighborhoods within a city,
111112 * although the Mixpanel Dashboard will just show you city level location specificity.
112- *
113- * @param {boolean } useIpAddressForGeolocation whether to automatically send the client IP Address.
113+ *
114+ * @param {boolean } useIpAddressForGeolocation whether to automatically send the client IP Address.
114115 * Defaults to true.
115- *
116+ *
116117 */
117118 setUseIpAddressForGeolocation ( useIpAddressForGeolocation ) {
118119 MixpanelReactNative . setUseIpAddressForGeolocation ( this . token , useIpAddressForGeolocation ) ;
@@ -126,7 +127,7 @@ export class Mixpanel {
126127 hasOptedOutTracking ( ) {
127128 return MixpanelReactNative . hasOptedOutTracking ( this . token ) ;
128129 }
129-
130+
130131 /**
131132 * Use this method to opt-in an already opted-out user from tracking. People updates and track
132133 * calls will be sent to Mixpanel after using this method.
@@ -176,10 +177,10 @@ export class Mixpanel {
176177 /**
177178 * The alias method creates an alias which Mixpanel will use to remap one id to another.
178179 * Multiple aliases can point to the same identifier.
179- *
180+ *
180181 * `mixpane.alias("New ID", mixpane.distinctId)`
181182 * `mixpane.alias("Newer ID", mixpane.distinctId)`
182- *
183+ *
183184 * <p>This call does not identify the user after. You must still call both identify() and
184185 * People.identify() if you wish the new alias to be used for Events and People.
185186 *
@@ -242,7 +243,7 @@ export class Mixpanel {
242243 * Pass null if no extra properties exist.
243244 * @param {object } groups A Map containing the group key value pairs for this event.
244245 *
245- */
246+ */
246247 trackWithGroups ( eventName , properties , groups ) {
247248 if ( ! StringHelper . isValid ( eventName ) ) {
248249 StringHelper . raiseError ( PARAMS . EVENT_NAME ) ;
@@ -434,13 +435,13 @@ export class Mixpanel {
434435 }
435436
436437 /**
437- * Returns the current distinct id of the user.
438+ * Returns the current distinct id of the user.
438439 * This is either the id automatically generated by the library or the id that has been passed by a call to identify().
439- *
440- * example of usage:
440+ *
441+ * example of usage:
441442 * <pre>
442443 * <code>
443- * const distinctId = await mixpanel.getDistinctId();
444+ * const distinctId = await mixpanel.getDistinctId();
444445 * </code>
445446 * </pre>
446447 *
@@ -730,7 +731,7 @@ export class MixpanelGroup {
730731
731732 /**
732733 * Permanently removes the property with the given name from the group's profile
733- *
734+ *
734735 * @param {string } prop name of a property to unset
735736 */
736737 unset ( prop ) {
@@ -744,7 +745,7 @@ export class MixpanelGroup {
744745 * Remove value from a list-valued property only if it is already present in the list.
745746 * If the property does not currently exist, the remove will be ignored.
746747 * If the property exists and is not list-valued, the remove will be ignored.
747- *
748+ *
748749 * @param {string } name the Group Analytics list-valued property that should have a value removed
749750 * @param {any } value the value that will be removed from the list
750751 */
0 commit comments