mixpanel-react-native
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -12,5 +12,17 @@ /** | ||
const mixpanel = await Mixpanel.init("token"); | ||
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", false, {"$lib_version": "1.0.0", "mp_lib": "react-native"}); | ||
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", false, {"$lib_version": "1.0.1", "mp_lib": "react-native"}); | ||
}); | ||
test(`it calls MixpanelReactNative setServerURL`, async () => { | ||
const mixpanel = await Mixpanel.init("token"); | ||
mixpanel.setServerURL("https://api-eu.mixpanel.com"); | ||
expect(NativeModules.MixpanelReactNative.setServerURL).toBeCalledWith("token", "https://api-eu.mixpanel.com"); | ||
}); | ||
test(`it calls MixpanelReactNative setLoggingEnabled`, async () => { | ||
const mixpanel = await Mixpanel.init("token"); | ||
mixpanel.setLoggingEnabled(true); | ||
expect(NativeModules.MixpanelReactNative.setLoggingEnabled).toBeCalledWith("token", true); | ||
}); | ||
test(`it calls MixpanelReactNative hasOptedOutTracking`, async () => { | ||
@@ -17,0 +29,0 @@ const mixpanel = await Mixpanel.init("token"); |
@@ -21,2 +21,4 @@ import * as ReactNative from 'react-native'; | ||
initialize: jest.fn(), | ||
setServerURL: jest.fn(), | ||
setLoggingEnabled: jest.fn(), | ||
hasOptedOutTracking: jest.fn(), | ||
@@ -23,0 +25,0 @@ optInTracking: jest.fn(), |
32
index.js
@@ -71,2 +71,34 @@ "use strict"; | ||
/** | ||
* 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 | ||
* - Note: This method will only work for iOS. For android, please refer to: | ||
* https://developer.mixpanel.com/docs/android | ||
* | ||
* @param {string} serverURL the base URL used for Mixpanel API requests | ||
* | ||
*/ | ||
setServerURL(serverURL) { | ||
if (DevicePlatform.iOS === Helper.getDevicePlatform()) { | ||
MixpanelReactNative.setServerURL(this.token, serverURL) | ||
} | ||
} | ||
/** | ||
* This allows enabling or disabling of all Mixpanel logs at run time. | ||
* - Note: This method will only work for iOS. For android, please refer to: | ||
* https://developer.mixpanel.com/docs/android | ||
* 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 | ||
* | ||
* @param {boolean} loggingEnabled whether to enable logging | ||
* | ||
*/ | ||
setLoggingEnabled(loggingEnabled) { | ||
if (DevicePlatform.iOS === Helper.getDevicePlatform()) { | ||
MixpanelReactNative.setLoggingEnabled(this.token, loggingEnabled) | ||
} | ||
} | ||
/** | ||
* Will return true if the user has opted out from tracking. | ||
@@ -73,0 +105,0 @@ * |
{ | ||
"name": "mixpanel-react-native", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Official React Native Tracking Library for Mixpanel Analytics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -61,5 +61,5 @@ <div align="center" style="text-align: center"> | ||
// Track with event-name | ||
mixpanel.track('TrackEvent'); | ||
mixpanel.track('Sent Message'); | ||
// Track with event-name and property | ||
mixpanel.track('TrackEvent', {'Status': 'Pending'}); | ||
mixpanel.track('Plan Selected', {'Plan': 'Premium'});; | ||
``` | ||
@@ -75,3 +75,2 @@ You're done! You've successfully integrated the Mixpanel React Native SDK into your app. To stay up to speed on important SDK releases and updates, star or watch our repository on [Github](https://github.com/mixpanel/mixpanel-react-native). | ||
Have any questions? Reach out to [support@mixpanel.com](mailto:support@mixpanel.com) to speak to someone smart, quickly. | ||
Have any questions? Reach out to Mixpanel [Support](https://help.mixpanel.com/hc/en-us/requests/new) to speak to someone smart, quickly. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1358250
1663
65
75