Hi,
Mixpanel is an analytics tool that enables you to capture data on how users interact with your digital product. Mixpanel then lets you analyze this data with simple, interactive reports that let you query and visualize the data with just a few clicks.
We are happy to announce that the Mixpanel React Native SDK is now supported in Vega. It’s still in beta, but we’re releasing it early so developers can start implementing and testing it in their apps.
The Mixpanel React Native SDK requires access to AsyncStorage ( ❌ AsyncStorage · React Native ). However, the community AsyncStorage is not supported by Vega(https://developer.amazon.com/docs/kepler-tv-api/asyncstorage.html). As a temporary workaround, you need to specify a storage parameter when initializing Mixpanel. For detailed instructions, please refer to the full guide below:
To install Mixpanel, under your app’s root directory:
npm install mixpanel-react-native@beta
To initialize Mixpanel in code:
// see https://developer.amazon.com/docs/kepler-tv-api/asyncstorage.html
const AsyncStorage = require("@amzn/react-native-kepler/Libraries/Storage/AsyncStorage");
const trackAutomaticEvents = false;
const useNative = false; // true only applies to iOS or Android
const mixpanel = new Mixpanel(‘YOUR_MIXPANEL_TOKEN’, trackAutomaticEvents, useNative, AsyncStorage);
mixpanel.init();
To send data:
// Track with event-name
mixpanel.track('Sent Message');
// Track with event-name and property
mixpanel.track('Plan Selected', {'Plan': 'Premium'});
For additional details, please refer to the Mixpanel developer documentation or explore the sample app.
Known limitations running in Vega:
- Automatic Events are currently not supported. Setting ‘trackAutomaticEvents’ to ‘true’ will have no effect.
- Certain Mixpanel properties, such as detailed device and screen information, are currently unavailable. These will be added in a future version once the Vega Developer Tools supports them.
- The default flush interval is set to 10 seconds. The data will not flush automatically when the app moves to the background.
If you have any issues or feedback, feel free to contact me at zihe.jia@mixpanel.com.
Zihe Jia
Software Engineer @ Mixpanel