mixpanel-react-native 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,26 @@
1
1
  #
2
2
 
3
+ ## [v2.1.0](https://github.com/mixpanel/mixpanel-react-native/tree/v2.1.0) (2022-09-14)
4
+
5
+ ### Enhancements
6
+
7
+ - add serverURL to init params and fix Android module [\#160](https://github.com/mixpanel/mixpanel-react-native/pull/160)
8
+
9
+ #
10
+
11
+ ## [v2.0.1](https://github.com/mixpanel/mixpanel-react-native/tree/v2.0.1) (2022-09-12)
12
+
13
+ ### Fixes
14
+
15
+ - update typescript and iOS bridging header [\#158](https://github.com/mixpanel/mixpanel-react-native/pull/158)
16
+
17
+ #
18
+
3
19
  ## [v2.0.0](https://github.com/mixpanel/mixpanel-react-native/tree/v2.0.0) (2022-09-09)
4
20
 
21
+ ### BREAKING CHANGE:
22
+ This major release removes all remaining calls to Mixpanel's `/decide` API endpoint. The main effect of this is that the SDK no longer fetches the remote status of your [project's "Automatically collect common mobile events" setting](https://help.mixpanel.com/hc/en-us/articles/115004596186#enable-or-disable-common-mobile-events). From this version forward, automatic event tracking can only be controlled by the, now required, parameter `trackAutomaticEvents`. Upon upgrading, existing implementations will need to add this parameter to their Mixpanel initializer calls.
23
+
5
24
  ### Enhancements
6
25
 
7
26
  - make trackAutomaticEvents required and bump versions to deprecate Decide [\#153](https://github.com/mixpanel/mixpanel-react-native/pull/153)
@@ -224,6 +243,10 @@ Report issues or give us any feedback is appreciated!
224
243
 
225
244
 
226
245
 
246
+
247
+
248
+
249
+
227
250
 
228
251
 
229
252
 
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
18
18
  s.preserve_paths = 'LICENSE', 'README.md', 'package.json', 'index.js'
19
19
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
20
20
 
21
- s.dependency "React"
22
- s.dependency "Mixpanel-swift", '4.0.1'
21
+ s.dependency "React-Core"
22
+ s.dependency "Mixpanel-swift", '4.0.2'
23
23
  end
package/README.md CHANGED
@@ -55,7 +55,8 @@ To start tracking with the library you must first initialize with your project t
55
55
  ```js
56
56
  import { Mixpanel } from 'mixpanel-react-native';
57
57
 
58
- const mixpanel = new Mixpanel("Your Project Token");
58
+ const trackAutomaticEvents = true;
59
+ const mixpanel = new Mixpanel("Your Project Token", trackAutomaticEvents);
59
60
  mixpanel.init();
60
61
 
61
62
  ```
@@ -81,7 +82,8 @@ import React from 'react';
81
82
  import { Button, SafeAreaView } from "react-native";
82
83
  import { Mixpanel } from 'mixpanel-react-native';
83
84
 
84
- const mixpanel = new Mixpanel("Your Project Token");
85
+ const trackAutomaticEvents = true;
86
+ const mixpanel = new Mixpanel("Your Project Token", trackAutomaticEvents);
85
87
  mixpanel.init();
86
88
 
87
89
  const SampleApp = () => {
@@ -9,13 +9,13 @@ import { NativeModules } from 'react-native';
9
9
 
10
10
  test(`it calls MixpanelReactNative initialize`, async () => {
11
11
  const mixpanel = await Mixpanel.init("token", true);
12
- expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, false, {"$lib_version": "2.0.0", "mp_lib": "react-native"});
12
+ expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, false, {"$lib_version": "2.1.0", "mp_lib": "react-native"});
13
13
  });
14
14
 
15
15
  test(`it calls MixpanelReactNative initialize with optOut and superProperties`, async () => {
16
16
  const mixpanel = new Mixpanel("token", true);
17
17
  mixpanel.init(true, {"super": "property"})
18
- expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, true, {"$lib_version": "2.0.0", "mp_lib": "react-native", "super": "property"});
18
+ expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, true, {"$lib_version": "2.1.0", "mp_lib": "react-native", "super": "property"}, "https://api.mixpanel.com");
19
19
  });
20
20
 
21
21
  test(`it calls MixpanelReactNative setServerURL`, async () => {
@@ -33,16 +33,17 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
33
33
 
34
34
 
35
35
  @ReactMethod
36
- public void initialize(String token, boolean trackAutomaticEvents, boolean optOutTrackingDefault, ReadableMap metadata, Promise promise) throws JSONException {
36
+ public void initialize(String token, boolean trackAutomaticEvents, boolean optOutTrackingDefault, ReadableMap metadata, String serverURL, Promise promise) throws JSONException {
37
37
  JSONObject mixpanelProperties = ReactNativeHelper.reactToJSON(metadata);
38
38
  AutomaticProperties.setAutomaticProperties(mixpanelProperties);
39
- MixpanelAPI.getInstance(this.mReactContext, token, optOutTrackingDefault, mixpanelProperties, null, trackAutomaticEvents);
39
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, optOutTrackingDefault, mixpanelProperties, null, trackAutomaticEvents);
40
+ instance.setServerURL(serverURL);
40
41
  promise.resolve(null);
41
42
  }
42
43
 
43
44
  @ReactMethod
44
- public void setServerURL(final String token, final boolean trackAutomaticEvents, final String serverURL, Promise promise) throws JSONException {
45
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
45
+ public void setServerURL(final String token, final String serverURL, Promise promise) throws JSONException {
46
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
46
47
  synchronized (instance) {
47
48
  instance.setServerURL(serverURL);
48
49
  promise.resolve(null);
@@ -50,8 +51,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
50
51
  }
51
52
 
52
53
  @ReactMethod
53
- public void setUseIpAddressForGeolocation(final String token, final boolean trackAutomaticEvents, boolean useIpAddressForGeolocation, Promise promise) throws JSONException {
54
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
54
+ public void setUseIpAddressForGeolocation(final String token, boolean useIpAddressForGeolocation, Promise promise) throws JSONException {
55
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
55
56
  synchronized (instance) {
56
57
  instance.setUseIpAddressForGeolocation(useIpAddressForGeolocation);
57
58
  promise.resolve(null);
@@ -59,8 +60,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
59
60
  }
60
61
 
61
62
  @ReactMethod
62
- public void setLoggingEnabled(final String token, final boolean trackAutomaticEvents, boolean enableLogging, Promise promise) throws JSONException {
63
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
63
+ public void setLoggingEnabled(final String token, boolean enableLogging, Promise promise) throws JSONException {
64
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
64
65
  synchronized (instance) {
65
66
  instance.setEnableLogging(enableLogging);
66
67
  promise.resolve(null);
@@ -68,16 +69,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
68
69
  }
69
70
 
70
71
  @ReactMethod
71
- public void hasOptedOutTracking(final String token, final boolean trackAutomaticEvents, Promise promise) {
72
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
72
+ public void hasOptedOutTracking(final String token, Promise promise) {
73
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
73
74
  synchronized (instance) {
74
75
  promise.resolve(instance.hasOptedOutTracking());
75
76
  }
76
77
  }
77
78
 
78
79
  @ReactMethod
79
- public void optInTracking(final String token, final boolean trackAutomaticEvents, Promise promise) throws JSONException {
80
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
80
+ public void optInTracking(final String token, Promise promise) throws JSONException {
81
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
81
82
  synchronized (instance) {
82
83
  instance.optInTracking();
83
84
  promise.resolve(null);
@@ -85,8 +86,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
85
86
  }
86
87
 
87
88
  @ReactMethod
88
- public void optOutTracking(final String token, final boolean trackAutomaticEvents, Promise promise) {
89
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
89
+ public void optOutTracking(final String token, Promise promise) {
90
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
90
91
  synchronized (instance) {
91
92
  instance.optOutTracking();
92
93
  promise.resolve(null);
@@ -94,8 +95,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
94
95
  }
95
96
 
96
97
  @ReactMethod
97
- public void identify(final String token, final boolean trackAutomaticEvents, final String distinctId, Promise promise) {
98
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
98
+ public void identify(final String token, final String distinctId, Promise promise) {
99
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
99
100
  synchronized (instance) {
100
101
  instance.identify(distinctId);
101
102
  promise.resolve(null);
@@ -103,24 +104,24 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
103
104
  }
104
105
 
105
106
  @ReactMethod
106
- public void getDistinctId(final String token, final boolean trackAutomaticEvents, Promise promise) {
107
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
107
+ public void getDistinctId(final String token, Promise promise) {
108
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
108
109
  synchronized (instance) {
109
110
  promise.resolve(instance.getDistinctId());
110
111
  }
111
112
  }
112
113
 
113
114
  @ReactMethod
114
- public void getDeviceId(final String token, final boolean trackAutomaticEvents, Promise promise) {
115
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
115
+ public void getDeviceId(final String token, Promise promise) {
116
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
116
117
  synchronized (instance) {
117
118
  promise.resolve(instance.getAnonymousId());
118
119
  }
119
120
  }
120
121
 
121
122
  @ReactMethod
122
- public void track(final String token, final boolean trackAutomaticEvents, final String eventName, ReadableMap properties, Promise promise) throws JSONException {
123
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
123
+ public void track(final String token, final String eventName, ReadableMap properties, Promise promise) throws JSONException {
124
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
124
125
  synchronized (instance) {
125
126
  JSONObject eventProperties = ReactNativeHelper.reactToJSON(properties);
126
127
  AutomaticProperties.appendLibraryProperties(eventProperties);
@@ -130,8 +131,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
130
131
  }
131
132
 
132
133
  @ReactMethod
133
- public void registerSuperProperties(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
134
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
134
+ public void registerSuperProperties(final String token, ReadableMap properties, Promise promise) throws JSONException {
135
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
135
136
  synchronized (instance) {
136
137
  JSONObject superProperties = ReactNativeHelper.reactToJSON(properties);
137
138
  instance.registerSuperProperties(superProperties);
@@ -140,8 +141,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
140
141
  }
141
142
 
142
143
  @ReactMethod
143
- public void registerSuperPropertiesOnce(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
144
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
144
+ public void registerSuperPropertiesOnce(final String token, ReadableMap properties, Promise promise) throws JSONException {
145
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
145
146
  synchronized (instance) {
146
147
  JSONObject superProperties = ReactNativeHelper.reactToJSON(properties);
147
148
  instance.registerSuperPropertiesOnce(superProperties);
@@ -150,8 +151,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
150
151
  }
151
152
 
152
153
  @ReactMethod
153
- public void unregisterSuperProperty(final String token, final boolean trackAutomaticEvents, String superPropertyName, Promise promise) {
154
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
154
+ public void unregisterSuperProperty(final String token, String superPropertyName, Promise promise) {
155
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
155
156
  synchronized (instance) {
156
157
  instance.unregisterSuperProperty(superPropertyName);
157
158
  promise.resolve(null);
@@ -159,8 +160,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
159
160
  }
160
161
 
161
162
  @ReactMethod
162
- public void union(final String token, final boolean trackAutomaticEvents, String name, ReadableArray value, Promise promise) throws JSONException {
163
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
163
+ public void union(final String token, String name, ReadableArray value, Promise promise) throws JSONException {
164
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
164
165
  synchronized (instance) {
165
166
  JSONArray propertyValue = ReactNativeHelper.reactToJSON(value);
166
167
  instance.getPeople().union(name, propertyValue);
@@ -169,16 +170,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
169
170
  }
170
171
 
171
172
  @ReactMethod
172
- public void getSuperProperties(final String token, final boolean trackAutomaticEvents, Promise promise) throws JSONException {
173
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
173
+ public void getSuperProperties(final String token, Promise promise) throws JSONException {
174
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
174
175
  synchronized (instance) {
175
176
  promise.resolve(ReactNativeHelper.convertJsonToMap(instance.getSuperProperties()));
176
177
  }
177
178
  }
178
179
 
179
180
  @ReactMethod
180
- public void clearSuperProperties(final String token, final boolean trackAutomaticEvents, Promise promise) {
181
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
181
+ public void clearSuperProperties(final String token, Promise promise) {
182
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
182
183
  synchronized (instance) {
183
184
  instance.clearSuperProperties();
184
185
  promise.resolve(null);
@@ -186,8 +187,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
186
187
  }
187
188
 
188
189
  @ReactMethod
189
- public void alias(final String token, final boolean trackAutomaticEvents, String alias, String original, Promise promise) {
190
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
190
+ public void alias(final String token, String alias, String original, Promise promise) {
191
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
191
192
  synchronized (instance) {
192
193
  instance.alias(alias, original);
193
194
  promise.resolve(null);
@@ -195,8 +196,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
195
196
  }
196
197
 
197
198
  @ReactMethod
198
- public void reset(final String token, final boolean trackAutomaticEvents, Promise promise) {
199
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
199
+ public void reset(final String token, Promise promise) {
200
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
200
201
  synchronized (instance) {
201
202
  instance.reset();
202
203
  promise.resolve(null);
@@ -204,8 +205,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
204
205
  }
205
206
 
206
207
  @ReactMethod
207
- public void flush(final String token, final boolean trackAutomaticEvents, Promise promise) {
208
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
208
+ public void flush(final String token, Promise promise) {
209
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
209
210
  synchronized (instance) {
210
211
  instance.flush();
211
212
  promise.resolve(null);
@@ -213,8 +214,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
213
214
  }
214
215
 
215
216
  @ReactMethod
216
- public void timeEvent(final String token, final boolean trackAutomaticEvents, final String eventName, Promise promise) {
217
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
217
+ public void timeEvent(final String token, final String eventName, Promise promise) {
218
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
218
219
  synchronized (instance) {
219
220
  instance.timeEvent(eventName);
220
221
  promise.resolve(null);
@@ -222,16 +223,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
222
223
  }
223
224
 
224
225
  @ReactMethod
225
- public void eventElapsedTime(final String token, final boolean trackAutomaticEvents, final String eventName, Promise promise) {
226
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
226
+ public void eventElapsedTime(final String token, final String eventName, Promise promise) {
227
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
227
228
  synchronized (instance) {
228
229
  promise.resolve(instance.eventElapsedTime(eventName));
229
230
  }
230
231
  }
231
232
 
232
233
  @ReactMethod
233
- public void set(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
234
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
234
+ public void set(final String token, ReadableMap properties, Promise promise) throws JSONException {
235
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
235
236
  synchronized (instance) {
236
237
  JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
237
238
  AutomaticProperties.appendLibraryProperties(sendProperties);
@@ -241,8 +242,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
241
242
  }
242
243
 
243
244
  @ReactMethod
244
- public void unset(final String token, final boolean trackAutomaticEvents, String propertyName, Promise promise) {
245
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
245
+ public void unset(final String token, String propertyName, Promise promise) {
246
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
246
247
  synchronized (instance) {
247
248
  instance.getPeople().unset(propertyName);
248
249
  promise.resolve(null);
@@ -250,8 +251,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
250
251
  }
251
252
 
252
253
  @ReactMethod
253
- public void setOnce(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
254
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
254
+ public void setOnce(final String token, ReadableMap properties, Promise promise) throws JSONException {
255
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
255
256
  synchronized (instance) {
256
257
  JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
257
258
  AutomaticProperties.appendLibraryProperties(sendProperties);
@@ -261,8 +262,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
261
262
  }
262
263
 
263
264
  @ReactMethod
264
- public void trackCharge(final String token, final boolean trackAutomaticEvents, double charge, ReadableMap properties, Promise promise) throws JSONException {
265
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
265
+ public void trackCharge(final String token, double charge, ReadableMap properties, Promise promise) throws JSONException {
266
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
266
267
  synchronized (instance) {
267
268
  JSONObject transactionValue = ReactNativeHelper.reactToJSON(properties);
268
269
  instance.getPeople().trackCharge(charge, transactionValue);
@@ -271,8 +272,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
271
272
  }
272
273
 
273
274
  @ReactMethod
274
- public void clearCharges(final String token, final boolean trackAutomaticEvents, Promise promise) {
275
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
275
+ public void clearCharges(final String token, Promise promise) {
276
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
276
277
  synchronized (instance) {
277
278
  instance.getPeople().clearCharges();
278
279
  promise.resolve(null);
@@ -280,9 +281,9 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
280
281
  }
281
282
 
282
283
  @ReactMethod
283
- public void increment(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) {
284
+ public void increment(final String token, ReadableMap properties, Promise promise) {
284
285
  Map incrementProperties = ReactNativeHelper.toMap(properties);
285
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
286
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
286
287
  synchronized (instance) {
287
288
  instance.getPeople().increment(incrementProperties);
288
289
  promise.resolve(null);
@@ -290,8 +291,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
290
291
  }
291
292
 
292
293
  @ReactMethod
293
- public void append(final String token, final boolean trackAutomaticEvents, String name, Dynamic value, Promise promise) throws JSONException {
294
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
294
+ public void append(final String token, String name, Dynamic value, Promise promise) throws JSONException {
295
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
295
296
  synchronized (instance) {
296
297
  instance.getPeople().append(name, ReactNativeHelper.dynamicToObject(value));
297
298
  promise.resolve(null);
@@ -299,8 +300,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
299
300
  }
300
301
 
301
302
  @ReactMethod
302
- public void deleteUser(final String token, final boolean trackAutomaticEvents, Promise promise) {
303
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
303
+ public void deleteUser(final String token, Promise promise) {
304
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
304
305
  synchronized (instance) {
305
306
  instance.getPeople().deleteUser();
306
307
  promise.resolve(null);
@@ -308,8 +309,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
308
309
  }
309
310
 
310
311
  @ReactMethod
311
- public void remove(final String token, final boolean trackAutomaticEvents, String name, Dynamic value, Promise promise) throws JSONException {
312
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
312
+ public void remove(final String token, String name, Dynamic value, Promise promise) throws JSONException {
313
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
313
314
  synchronized (instance) {
314
315
  instance.getPeople().remove(name, ReactNativeHelper.dynamicToObject(value));
315
316
  promise.resolve(null);
@@ -317,8 +318,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
317
318
  }
318
319
 
319
320
  @ReactMethod
320
- public void trackWithGroups(final String token, final boolean trackAutomaticEvents, String eventName, ReadableMap properties, ReadableMap groups, Promise promise) {
321
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
321
+ public void trackWithGroups(final String token, String eventName, ReadableMap properties, ReadableMap groups, Promise promise) {
322
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
322
323
  synchronized (instance) {
323
324
  Map eventProperties = ReactNativeHelper.toMap(properties);
324
325
  Map eventGroups = ReactNativeHelper.toMap(groups);
@@ -329,8 +330,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
329
330
 
330
331
 
331
332
  @ReactMethod
332
- public void setGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
333
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
333
+ public void setGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
334
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
334
335
  synchronized (instance) {
335
336
  instance.setGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID));
336
337
  promise.resolve(null);
@@ -338,8 +339,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
338
339
  }
339
340
 
340
341
  @ReactMethod
341
- public void setGroups(final String token, final boolean trackAutomaticEvents, String groupKey, ReadableArray groupIDs, Promise promise) throws JSONException {
342
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
342
+ public void setGroups(final String token, String groupKey, ReadableArray groupIDs, Promise promise) throws JSONException {
343
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
343
344
  synchronized (instance) {
344
345
  instance.setGroup(groupKey, Arrays.asList(ReactNativeHelper.toArray(groupIDs)));
345
346
  promise.resolve(null);
@@ -347,8 +348,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
347
348
  }
348
349
 
349
350
  @ReactMethod
350
- public void addGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
351
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
351
+ public void addGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
352
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
352
353
  synchronized (instance) {
353
354
  instance.addGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID));
354
355
  promise.resolve(null);
@@ -356,8 +357,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
356
357
  }
357
358
 
358
359
  @ReactMethod
359
- public void removeGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
360
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
360
+ public void removeGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
361
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
361
362
  synchronized (instance) {
362
363
  instance.removeGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID));
363
364
  promise.resolve(null);
@@ -365,8 +366,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
365
366
  }
366
367
 
367
368
  @ReactMethod
368
- public void deleteGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
369
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
369
+ public void deleteGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
370
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
370
371
  synchronized (instance) {
371
372
  instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).deleteGroup();
372
373
  promise.resolve(null);
@@ -374,8 +375,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
374
375
  }
375
376
 
376
377
  @ReactMethod
377
- public void groupSetProperties(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
378
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
378
+ public void groupSetProperties(final String token, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
379
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
379
380
  synchronized (instance) {
380
381
  JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
381
382
  instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).set(sendProperties);
@@ -384,8 +385,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
384
385
  }
385
386
 
386
387
  @ReactMethod
387
- public void groupSetPropertyOnce(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
388
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
388
+ public void groupSetPropertyOnce(final String token, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
389
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
389
390
  synchronized (instance) {
390
391
  JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
391
392
  instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).setOnce(sendProperties);
@@ -394,8 +395,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
394
395
  }
395
396
 
396
397
  @ReactMethod
397
- public void groupUnsetProperty(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, String propertyName, Promise promise) throws JSONException {
398
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
398
+ public void groupUnsetProperty(final String token, String groupKey, Dynamic groupID, String propertyName, Promise promise) throws JSONException {
399
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
399
400
  synchronized (instance) {
400
401
  instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).unset(propertyName);
401
402
  promise.resolve(null);
@@ -403,8 +404,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
403
404
  }
404
405
 
405
406
  @ReactMethod
406
- public void groupRemovePropertyValue(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, String name, Dynamic value, Promise promise) throws JSONException {
407
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
407
+ public void groupRemovePropertyValue(final String token, String groupKey, Dynamic groupID, String name, Dynamic value, Promise promise) throws JSONException {
408
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
408
409
  synchronized (instance) {
409
410
  instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).remove(name, ReactNativeHelper.dynamicToObject(value));
410
411
  promise.resolve(null);
@@ -412,8 +413,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
412
413
  }
413
414
 
414
415
  @ReactMethod
415
- public void groupUnionProperty(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, String name, ReadableArray values, Promise promise) throws JSONException {
416
- MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
416
+ public void groupUnionProperty(final String token, String groupKey, Dynamic groupID, String name, ReadableArray values, Promise promise) throws JSONException {
417
+ MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, true);
417
418
  synchronized (instance) {
418
419
  JSONArray arrayValues = ReactNativeHelper.reactToJSON(values);
419
420
  instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).union(name, arrayValues);
@@ -290,7 +290,8 @@
290
290
  <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:
291
291
 
292
292
  <pre><code>
293
- const mixpanel = new Mixpanel('your project token');
293
+ const trackAutomaticEvents = true;
294
+ const mixpanel = new Mixpanel('your project token', trackAutomaticEvents);
294
295
  mixpanel.init();
295
296
  </code></pre>
296
297
 
@@ -308,7 +309,7 @@ Initializes Mixpanel and return an instance of Mixpanel the given project token.
308
309
 
309
310
  <dt class="tag-source">Source:</dt>
310
311
  <dd class="tag-source"><ul class="dummy"><li>
311
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line84">line 84</a>
312
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line85">line 85</a>
312
313
  </li></ul></dd>
313
314
 
314
315
 
@@ -468,7 +469,7 @@ Initializes Mixpanel and return an instance of Mixpanel the given project token.
468
469
 
469
470
  <dt class="tag-source">Source:</dt>
470
471
  <dd class="tag-source"><ul class="dummy"><li>
471
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line309">line 309</a>
472
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line310">line 310</a>
472
473
  </li></ul></dd>
473
474
 
474
475
 
@@ -635,7 +636,7 @@ People.identify() if you wish the new alias to be used for Events and People.
635
636
 
636
637
  <dt class="tag-source">Source:</dt>
637
638
  <dd class="tag-source"><ul class="dummy"><li>
638
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line210">line 210</a>
639
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line211">line 211</a>
639
640
  </li></ul></dd>
640
641
 
641
642
 
@@ -728,7 +729,7 @@ superProperties registered before the clearSuperProperties method was called.
728
729
 
729
730
  <dt class="tag-source">Source:</dt>
730
731
  <dd class="tag-source"><ul class="dummy"><li>
731
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line417">line 417</a>
732
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line418">line 418</a>
732
733
  </li></ul></dd>
733
734
 
734
735
 
@@ -890,7 +891,7 @@ to Group Analytics using the same group value will create and store new values.<
890
891
 
891
892
  <dt class="tag-source">Source:</dt>
892
893
  <dd class="tag-source"><ul class="dummy"><li>
893
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line337">line 337</a>
894
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line338">line 338</a>
894
895
  </li></ul></dd>
895
896
 
896
897
 
@@ -1027,7 +1028,7 @@ to Group Analytics using the same group value will create and store new values.<
1027
1028
 
1028
1029
  <dt class="tag-source">Source:</dt>
1029
1030
  <dd class="tag-source"><ul class="dummy"><li>
1030
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line442">line 442</a>
1031
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line443">line 443</a>
1031
1032
  </li></ul></dd>
1032
1033
 
1033
1034
 
@@ -1143,7 +1144,7 @@ send all remaining messages to the server.
1143
1144
 
1144
1145
  <dt class="tag-source">Source:</dt>
1145
1146
  <dd class="tag-source"><ul class="dummy"><li>
1146
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line502">line 502</a>
1147
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line503">line 503</a>
1147
1148
  </li></ul></dd>
1148
1149
 
1149
1150
 
@@ -1239,7 +1240,7 @@ const deviceId = await mixpanel.getDeviceId();
1239
1240
 
1240
1241
  <dt class="tag-source">Source:</dt>
1241
1242
  <dd class="tag-source"><ul class="dummy"><li>
1242
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line489">line 489</a>
1243
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line490">line 490</a>
1243
1244
  </li></ul></dd>
1244
1245
 
1245
1246
 
@@ -1357,7 +1358,7 @@ const distinctId = await mixpanel.getDistinctId();
1357
1358
 
1358
1359
  <dt class="tag-source">Source:</dt>
1359
1360
  <dd class="tag-source"><ul class="dummy"><li>
1360
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line471">line 471</a>
1361
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line472">line 472</a>
1361
1362
  </li></ul></dd>
1362
1363
 
1363
1364
 
@@ -1540,7 +1541,7 @@ Group Analytics properties.
1540
1541
 
1541
1542
  <dt class="tag-source">Source:</dt>
1542
1543
  <dd class="tag-source"><ul class="dummy"><li>
1543
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line299">line 299</a>
1544
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line300">line 300</a>
1544
1545
  </li></ul></dd>
1545
1546
 
1546
1547
 
@@ -1640,7 +1641,7 @@ People Analytics properties.
1640
1641
 
1641
1642
  <dt class="tag-source">Source:</dt>
1642
1643
  <dd class="tag-source"><ul class="dummy"><li>
1643
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line249">line 249</a>
1644
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line250">line 250</a>
1644
1645
  </li></ul></dd>
1645
1646
 
1646
1647
 
@@ -1754,7 +1755,7 @@ and persist beyond the lifetime of your application.
1754
1755
 
1755
1756
  <dt class="tag-source">Source:</dt>
1756
1757
  <dd class="tag-source"><ul class="dummy"><li>
1757
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line405">line 405</a>
1758
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line406">line 406</a>
1758
1759
  </li></ul></dd>
1759
1760
 
1760
1761
 
@@ -1864,7 +1865,7 @@ and persist beyond the lifetime of your application.
1864
1865
 
1865
1866
  <dt class="tag-source">Source:</dt>
1866
1867
  <dd class="tag-source"><ul class="dummy"><li>
1867
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line147">line 147</a>
1868
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line148">line 148</a>
1868
1869
  </li></ul></dd>
1869
1870
 
1870
1871
 
@@ -2035,7 +2036,7 @@ your application.
2035
2036
 
2036
2037
  <dt class="tag-source">Source:</dt>
2037
2038
  <dd class="tag-source"><ul class="dummy"><li>
2038
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line190">line 190</a>
2039
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line191">line 191</a>
2039
2040
  </li></ul></dd>
2040
2041
 
2041
2042
 
@@ -2285,7 +2286,7 @@ This method will internally track an opt-in event to your project.
2285
2286
 
2286
2287
  <dt class="tag-source">Source:</dt>
2287
2288
  <dd class="tag-source"><ul class="dummy"><li>
2288
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line157">line 157</a>
2289
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line158">line 158</a>
2289
2290
  </li></ul></dd>
2290
2291
 
2291
2292
 
@@ -2377,7 +2378,7 @@ This method will also remove any user-related information from the device.
2377
2378
 
2378
2379
  <dt class="tag-source">Source:</dt>
2379
2380
  <dd class="tag-source"><ul class="dummy"><li>
2380
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line168">line 168</a>
2381
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line169">line 169</a>
2381
2382
  </li></ul></dd>
2382
2383
 
2383
2384
 
@@ -2524,7 +2525,7 @@ to remove a superProperty, call unregisterSuperProperty() or clearSuperPropertie
2524
2525
 
2525
2526
  <dt class="tag-source">Source:</dt>
2526
2527
  <dd class="tag-source"><ul class="dummy"><li>
2527
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line359">line 359</a>
2528
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line360">line 360</a>
2528
2529
  </li></ul></dd>
2529
2530
 
2530
2531
 
@@ -2664,7 +2665,7 @@ same names has already been registered.
2664
2665
 
2665
2666
  <dt class="tag-source">Source:</dt>
2666
2667
  <dd class="tag-source"><ul class="dummy"><li>
2667
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line374">line 374</a>
2668
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line375">line 375</a>
2668
2669
  </li></ul></dd>
2669
2670
 
2670
2671
 
@@ -2824,7 +2825,7 @@ same names has already been registered.
2824
2825
 
2825
2826
  <dt class="tag-source">Source:</dt>
2826
2827
  <dd class="tag-source"><ul class="dummy"><li>
2827
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line322">line 322</a>
2828
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line323">line 323</a>
2828
2829
  </li></ul></dd>
2829
2830
 
2830
2831
 
@@ -2913,7 +2914,7 @@ same names has already been registered.
2913
2914
 
2914
2915
  <dt class="tag-source">Source:</dt>
2915
2916
  <dd class="tag-source"><ul class="dummy"><li>
2916
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line453">line 453</a>
2917
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line454">line 454</a>
2917
2918
  </li></ul></dd>
2918
2919
 
2919
2920
 
@@ -3051,7 +3052,7 @@ when the app enters the background on iOS. This is set to true by default.
3051
3052
 
3052
3053
  <dt class="tag-source">Source:</dt>
3053
3054
  <dd class="tag-source"><ul class="dummy"><li>
3054
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line121">line 121</a>
3055
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line122">line 122</a>
3055
3056
  </li></ul></dd>
3056
3057
 
3057
3058
 
@@ -3211,7 +3212,7 @@ when the app enters the background on iOS. This is set to true by default.
3211
3212
 
3212
3213
  <dt class="tag-source">Source:</dt>
3213
3214
  <dd class="tag-source"><ul class="dummy"><li>
3214
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line283">line 283</a>
3215
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line284">line 284</a>
3215
3216
  </li></ul></dd>
3216
3217
 
3217
3218
 
@@ -3350,7 +3351,7 @@ you are running into issues with the SDK that you want to debug
3350
3351
 
3351
3352
  <dt class="tag-source">Source:</dt>
3352
3353
  <dd class="tag-source"><ul class="dummy"><li>
3353
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line110">line 110</a>
3354
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line111">line 111</a>
3354
3355
  </li></ul></dd>
3355
3356
 
3356
3357
 
@@ -3489,7 +3490,7 @@ To route data to Mixpanel's EU servers, set to https://api-eu.mixpanel.com
3489
3490
 
3490
3491
  <dt class="tag-source">Source:</dt>
3491
3492
  <dd class="tag-source"><ul class="dummy"><li>
3492
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line98">line 98</a>
3493
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line99">line 99</a>
3493
3494
  </li></ul></dd>
3494
3495
 
3495
3496
 
@@ -3629,7 +3630,7 @@ Defaults to true.</td>
3629
3630
 
3630
3631
  <dt class="tag-source">Source:</dt>
3631
3632
  <dd class="tag-source"><ul class="dummy"><li>
3632
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line138">line 138</a>
3633
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line139">line 139</a>
3633
3634
  </li></ul></dd>
3634
3635
 
3635
3636
 
@@ -3768,7 +3769,7 @@ property, representing the number of seconds between your calls.
3768
3769
 
3769
3770
  <dt class="tag-source">Source:</dt>
3770
3771
  <dd class="tag-source"><ul class="dummy"><li>
3771
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line428">line 428</a>
3772
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line429">line 429</a>
3772
3773
  </li></ul></dd>
3773
3774
 
3774
3775
 
@@ -3934,7 +3935,7 @@ that event.
3934
3935
 
3935
3936
  <dt class="tag-source">Source:</dt>
3936
3937
  <dd class="tag-source"><ul class="dummy"><li>
3937
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line232">line 232</a>
3938
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line233">line 233</a>
3938
3939
  </li></ul></dd>
3939
3940
 
3940
3941
 
@@ -4123,7 +4124,7 @@ that event. Group key/value pairs are upserted into the property map before trac
4123
4124
 
4124
4125
  <dt class="tag-source">Source:</dt>
4125
4126
  <dd class="tag-source"><ul class="dummy"><li>
4126
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line267">line 267</a>
4127
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line268">line 268</a>
4127
4128
  </li></ul></dd>
4128
4129
 
4129
4130
 
@@ -4264,7 +4265,7 @@ To clear all superProperties, use clearSuperProperties()
4264
4265
 
4265
4266
  <dt class="tag-source">Source:</dt>
4266
4267
  <dd class="tag-source"><ul class="dummy"><li>
4267
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line390">line 390</a>
4268
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line391">line 391</a>
4268
4269
  </li></ul></dd>
4269
4270
 
4270
4271
 
@@ -4316,7 +4317,7 @@ To clear all superProperties, use clearSuperProperties()
4316
4317
  <br class="clear">
4317
4318
 
4318
4319
  <footer>
4319
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Sep 09 2022 15:21:59 GMT-0700 (Pacific Daylight Time)
4320
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Wed Sep 14 2022 09:05:09 GMT-0700 (Pacific Daylight Time)
4320
4321
  </footer>
4321
4322
 
4322
4323
  <script> prettyPrint(); </script>
@@ -95,7 +95,7 @@
95
95
 
96
96
  <dt class="tag-source">Source:</dt>
97
97
  <dd class="tag-source"><ul class="dummy"><li>
98
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line719">line 719</a>
98
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line720">line 720</a>
99
99
  </li></ul></dd>
100
100
 
101
101
 
@@ -284,7 +284,7 @@ If the property exists and is not list-valued, the remove will be ignored.
284
284
 
285
285
  <dt class="tag-source">Source:</dt>
286
286
  <dd class="tag-source"><ul class="dummy"><li>
287
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line790">line 790</a>
287
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line791">line 791</a>
288
288
  </li></ul></dd>
289
289
 
290
290
 
@@ -446,7 +446,7 @@ possibly overwriting an existing property with the same name.
446
446
 
447
447
  <dt class="tag-source">Source:</dt>
448
448
  <dd class="tag-source"><ul class="dummy"><li>
449
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line738">line 738</a>
449
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line739">line 739</a>
450
450
  </li></ul></dd>
451
451
 
452
452
 
@@ -606,7 +606,7 @@ possibly overwriting an existing property with the same name.
606
606
 
607
607
  <dt class="tag-source">Source:</dt>
608
608
  <dd class="tag-source"><ul class="dummy"><li>
609
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line757">line 757</a>
609
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line758">line 758</a>
610
610
  </li></ul></dd>
611
611
 
612
612
 
@@ -768,7 +768,7 @@ If the property exists and is not list-valued, the union will be ignored.
768
768
 
769
769
  <dt class="tag-source">Source:</dt>
770
770
  <dd class="tag-source"><ul class="dummy"><li>
771
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line806">line 806</a>
771
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line807">line 807</a>
772
772
  </li></ul></dd>
773
773
 
774
774
 
@@ -905,7 +905,7 @@ If the property exists and is not list-valued, the union will be ignored.
905
905
 
906
906
  <dt class="tag-source">Source:</dt>
907
907
  <dd class="tag-source"><ul class="dummy"><li>
908
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line775">line 775</a>
908
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line776">line 776</a>
909
909
  </li></ul></dd>
910
910
 
911
911
 
@@ -957,7 +957,7 @@ If the property exists and is not list-valued, the union will be ignored.
957
957
  <br class="clear">
958
958
 
959
959
  <footer>
960
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Sep 09 2022 15:21:59 GMT-0700 (Pacific Daylight Time)
960
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Wed Sep 14 2022 09:05:10 GMT-0700 (Pacific Daylight Time)
961
961
  </footer>
962
962
 
963
963
  <script> prettyPrint(); </script>
package/docs/People.html CHANGED
@@ -100,7 +100,7 @@ call to identify using a different id.</div>
100
100
 
101
101
  <dt class="tag-source">Source:</dt>
102
102
  <dd class="tag-source"><ul class="dummy"><li>
103
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line518">line 518</a>
103
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line519">line 519</a>
104
104
  </li></ul></dd>
105
105
 
106
106
 
@@ -289,7 +289,7 @@ currently have a list value, the append will be ignored.
289
289
 
290
290
  <dt class="tag-source">Source:</dt>
291
291
  <dd class="tag-source"><ul class="dummy"><li>
292
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line609">line 609</a>
292
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line610">line 610</a>
293
293
  </li></ul></dd>
294
294
 
295
295
 
@@ -377,7 +377,7 @@ currently have a list value, the append will be ignored.
377
377
 
378
378
  <dt class="tag-source">Source:</dt>
379
379
  <dd class="tag-source"><ul class="dummy"><li>
380
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line699">line 699</a>
380
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line700">line 700</a>
381
381
  </li></ul></dd>
382
382
 
383
383
 
@@ -468,7 +468,7 @@ to People Analytics using the same distinct id will create and store new values.
468
468
 
469
469
  <dt class="tag-source">Source:</dt>
470
470
  <dd class="tag-source"><ul class="dummy"><li>
471
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line709">line 709</a>
471
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line710">line 710</a>
472
472
  </li></ul></dd>
473
473
 
474
474
 
@@ -630,7 +630,7 @@ provide a negative number for the value.
630
630
 
631
631
  <dt class="tag-source">Source:</dt>
632
632
  <dd class="tag-source"><ul class="dummy"><li>
633
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line577">line 577</a>
633
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line578">line 578</a>
634
634
  </li></ul></dd>
635
635
 
636
636
 
@@ -792,7 +792,7 @@ If the property exists and is not list-valued, the remove will be ignored.
792
792
 
793
793
  <dt class="tag-source">Source:</dt>
794
794
  <dd class="tag-source"><ul class="dummy"><li>
795
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line653">line 653</a>
795
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line654">line 654</a>
796
796
  </li></ul></dd>
797
797
 
798
798
 
@@ -954,7 +954,7 @@ possibly overwriting an existing property with the same name.
954
954
 
955
955
  <dt class="tag-source">Source:</dt>
956
956
  <dd class="tag-source"><ul class="dummy"><li>
957
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line535">line 535</a>
957
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line536">line 536</a>
958
958
  </li></ul></dd>
959
959
 
960
960
 
@@ -1114,7 +1114,7 @@ possibly overwriting an existing property with the same name.
1114
1114
 
1115
1115
  <dt class="tag-source">Source:</dt>
1116
1116
  <dd class="tag-source"><ul class="dummy"><li>
1117
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line554">line 554</a>
1117
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line555">line 555</a>
1118
1118
  </li></ul></dd>
1119
1119
 
1120
1120
 
@@ -1274,7 +1274,7 @@ possibly overwriting an existing property with the same name.
1274
1274
 
1275
1275
  <dt class="tag-source">Source:</dt>
1276
1276
  <dd class="tag-source"><ul class="dummy"><li>
1277
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line685">line 685</a>
1277
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line686">line 686</a>
1278
1278
  </li></ul></dd>
1279
1279
 
1280
1280
 
@@ -1436,7 +1436,7 @@ If the property exists and is not list-valued, the union will be ignored.
1436
1436
 
1437
1437
  <dt class="tag-source">Source:</dt>
1438
1438
  <dd class="tag-source"><ul class="dummy"><li>
1439
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line632">line 632</a>
1439
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line633">line 633</a>
1440
1440
  </li></ul></dd>
1441
1441
 
1442
1442
 
@@ -1573,7 +1573,7 @@ If the property exists and is not list-valued, the union will be ignored.
1573
1573
 
1574
1574
  <dt class="tag-source">Source:</dt>
1575
1575
  <dd class="tag-source"><ul class="dummy"><li>
1576
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line672">line 672</a>
1576
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line673">line 673</a>
1577
1577
  </li></ul></dd>
1578
1578
 
1579
1579
 
@@ -1625,7 +1625,7 @@ If the property exists and is not list-valued, the union will be ignored.
1625
1625
  <br class="clear">
1626
1626
 
1627
1627
  <footer>
1628
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Sep 09 2022 15:21:59 GMT-0700 (Pacific Daylight Time)
1628
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Wed Sep 14 2022 09:05:10 GMT-0700 (Pacific Daylight Time)
1629
1629
  </footer>
1630
1630
 
1631
1631
  <script> prettyPrint(); </script>
package/docs/index.html CHANGED
@@ -96,7 +96,8 @@ We'd also love for you to come and work with us! Check out <strong><a href="http
96
96
  <p>To start tracking with the library you must first initialize with your project token. You can get your project token from <a href="https://mixpanel.com/settings/project">project settings</a>.</p>
97
97
  <pre class="prettyprint source lang-js"><code>import { Mixpanel } from 'mixpanel-react-native';
98
98
 
99
- const mixpanel = new Mixpanel(&quot;Your Project Token&quot;);
99
+ const trackAutomaticEvents = true;
100
+ const mixpanel = new Mixpanel(&quot;Your Project Token&quot;, trackAutomaticEvents);
100
101
  mixpanel.init();
101
102
 
102
103
  </code></pre>
@@ -119,7 +120,8 @@ import React from 'react';
119
120
  import { Button, SafeAreaView } from &quot;react-native&quot;;
120
121
  import { Mixpanel } from 'mixpanel-react-native';
121
122
 
122
- const mixpanel = new Mixpanel(&quot;Your Project Token&quot;);
123
+ const trackAutomaticEvents = true;
124
+ const mixpanel = new Mixpanel(&quot;Your Project Token&quot;, trackAutomaticEvents);
123
125
  mixpanel.init();
124
126
 
125
127
  const SampleApp = () => {
@@ -176,7 +178,7 @@ Please refer to our <a href="https://mixpanel.com/legal/app-store-privacy-detai
176
178
  <br class="clear">
177
179
 
178
180
  <footer>
179
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Sep 09 2022 15:21:59 GMT-0700 (Pacific Daylight Time)
181
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Wed Sep 14 2022 09:05:09 GMT-0700 (Pacific Daylight Time)
180
182
  </footer>
181
183
 
182
184
  <script> prettyPrint(); </script>
@@ -89,16 +89,17 @@ export class Mixpanel {
89
89
  * @param {object} superProperties Optional A Map containing the key value pairs of the super properties to register
90
90
  *
91
91
  */
92
- async init(optOutTrackingDefault = DEFAULT_OPT_OUT, superProperties = {}) {
92
+ async init(optOutTrackingDefault = DEFAULT_OPT_OUT, superProperties = {}, serverURL = "https://api.mixpanel.com") {
93
93
  let metadata = Helper.getMetaData();
94
- await MixpanelReactNative.initialize(this.token, this.trackAutomaticEvents, optOutTrackingDefault, {...metadata, ...superProperties});
94
+ await MixpanelReactNative.initialize(this.token, this.trackAutomaticEvents, optOutTrackingDefault, {...metadata, ...superProperties}, serverURL);
95
95
  }
96
96
 
97
97
  /**
98
98
  * @deprecated since version 1.3.0. To initialize Mixpanel, please use the instance method `init` instead. See the example below:
99
99
  *
100
100
  * &lt;pre>&lt;code>
101
- * const mixpanel = new Mixpanel('your project token');
101
+ * const trackAutomaticEvents = true;
102
+ * const mixpanel = new Mixpanel('your project token', trackAutomaticEvents);
102
103
  * mixpanel.init();
103
104
  * &lt;/code>&lt;/pre>
104
105
  *
@@ -927,7 +928,7 @@ class ObjectHelper {
927
928
  <br class="clear">
928
929
 
929
930
  <footer>
930
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Sep 09 2022 15:21:59 GMT-0700 (Pacific Daylight Time)
931
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Wed Sep 14 2022 09:05:09 GMT-0700 (Pacific Daylight Time)
931
932
  </footer>
932
933
 
933
934
  <script> prettyPrint(); </script>
package/index.d.ts CHANGED
@@ -2,9 +2,9 @@ type MixpanelType = any;
2
2
  type MixpanelProperties = { [key: string]: MixpanelType };
3
3
 
4
4
  export class Mixpanel {
5
- constructor(token: string);
6
- static init(token: string, optOutTrackingDefault?: boolean): Promise<Mixpanel>;
7
- init(optOutTrackingDefault?: boolean, superProperties?: MixpanelProperties): Promise<void>;
5
+ constructor(token: string, trackAutomaticEvents: boolean);
6
+ static init(token: string, trackAutomaticEvents: boolean, optOutTrackingDefault?: boolean): Promise<Mixpanel>;
7
+ init(optOutTrackingDefault?: boolean, superProperties?: MixpanelProperties, serverURL?: String): Promise<void>;
8
8
  setServerURL(serverURL: string): void;
9
9
  setLoggingEnabled(loggingEnabled: boolean): void;
10
10
  setFlushOnBackground(flushOnBackground: boolean): void;
package/index.js CHANGED
@@ -61,16 +61,17 @@ export class Mixpanel {
61
61
  * @param {object} superProperties Optional A Map containing the key value pairs of the super properties to register
62
62
  *
63
63
  */
64
- async init(optOutTrackingDefault = DEFAULT_OPT_OUT, superProperties = {}) {
64
+ async init(optOutTrackingDefault = DEFAULT_OPT_OUT, superProperties = {}, serverURL = "https://api.mixpanel.com") {
65
65
  let metadata = Helper.getMetaData();
66
- await MixpanelReactNative.initialize(this.token, this.trackAutomaticEvents, optOutTrackingDefault, {...metadata, ...superProperties});
66
+ await MixpanelReactNative.initialize(this.token, this.trackAutomaticEvents, optOutTrackingDefault, {...metadata, ...superProperties}, serverURL);
67
67
  }
68
68
 
69
69
  /**
70
70
  * @deprecated since version 1.3.0. To initialize Mixpanel, please use the instance method `init` instead. See the example below:
71
71
  *
72
72
  * <pre><code>
73
- * const mixpanel = new Mixpanel('your project token');
73
+ * const trackAutomaticEvents = true;
74
+ * const mixpanel = new Mixpanel('your project token', trackAutomaticEvents);
74
75
  * mixpanel.init();
75
76
  * </code></pre>
76
77
  *
@@ -5,7 +5,7 @@
5
5
 
6
6
  // MARK: - Mixpanel Instance
7
7
 
8
- RCT_EXTERN_METHOD(initialize:(NSString *)token optOutTrackingByDefault:(BOOL)optOutTrackingByDefault properties:(NSDictionary *)properties resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
8
+ RCT_EXTERN_METHOD(initialize:(NSString *)token trackAutomaticEvents:(BOOL)trackAutomaticEvents optOutTrackingByDefault:(BOOL)optOutTrackingByDefault properties:(NSDictionary *)properties serverURL:(NSString *)serverURL resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
9
9
 
10
10
  // Mark: - Settings
11
11
  RCT_EXTERN_METHOD(setServerURL:(NSString *)token serverURL:(NSString *)serverURL resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
@@ -16,12 +16,14 @@ open class MixpanelReactNative: NSObject {
16
16
  trackAutomaticEvents: Bool,
17
17
  optOutTrackingByDefault: Bool = false,
18
18
  properties: [String: Any],
19
+ serverURL: String,
19
20
  resolver resolve: RCTPromiseResolveBlock,
20
21
  rejecter reject: RCTPromiseRejectBlock) -> Void {
21
22
  AutomaticProperties.setAutomaticProperties(properties)
22
23
  Mixpanel.initialize(token: token, trackAutomaticEvents: trackAutomaticEvents, flushInterval: Constants.DEFAULT_FLUSH_INTERVAL,
23
24
  instanceName: token, optOutTrackingByDefault: optOutTrackingByDefault,
24
- superProperties: MixpanelTypeHandler.processProperties(properties: properties, includeLibInfo: true))
25
+ superProperties: MixpanelTypeHandler.processProperties(properties: properties, includeLibInfo: true),
26
+ serverURL: serverURL)
25
27
  resolve(true)
26
28
  }
27
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-react-native",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Official React Native Tracking Library for Mixpanel Analytics",
5
5
  "main": "index.js",
6
6
  "scripts": {