mixpanel / mixpanel-react-native

Official React Native Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
105 stars 44 forks source link

Add Expo support #223

Closed zihejia closed 6 months ago

zihejia commented 6 months ago

This PR introduces support for Expo, React Native Web, and any platform using React Native that does not support iOS and Android. To activate this feature, initialize Mixpanel with an additional parameter useNative set to false. This will enable Javascript mode.

 const trackAutomaticEvents = false;
 const useNative = false;
 const mixpanel = new Mixpanel(
    "YOUR_MIXPANEL_TOKEN",
    trackAutomaticEvents,
    useNative
  );
 mixpanel.init();

To try the Expo sample app, navigate to Samples/MixpanelExpo, run npm install, and then execute npm run ios or npm run android

Known limitations and differences compared to the native mode (iOS/Android):