mixpanel / mixpanel-react-native

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

It only track on Android in iOS nothing at all #72

Closed ZaikinaEvgeniya-2 closed 3 years ago

ZaikinaEvgeniya-2 commented 3 years ago

Hello,

I track event and it works fine for android and do not work for ios, without any error

this.mixpanel = await Mixpanel.init(APP_TOKEN)

this.mixpanel.track(event)

"react-native": "0.61.5", "mixpanel-react-native": "^1.2.4",

zihejia commented 3 years ago

hi @ZaikinaEvgeniya-2. This issue might be related to the improper initialization of Mixpanel. #70 . We will improve our examples and provide more tips to avoid this issue. Can you share a minimum sample app or a js file causing the issue? It will be super helpful for us to understand more corner cases.

zihejia commented 3 years ago

The Mixpanel class method init() is potentially causing issues and we are now deprecating it. Please try our latest version 1.3.1 and use the instance method init() instead. We've updated all our docs.

import { Mixpanel } from 'mixpanel-react-native';

const mixpanel = new Mixpanel("Your Project Token");
mixpanel.init();

More examples: https://github.com/mixpanel/mixpanel-react-native/tree/master/Samples.

This folder contains 3 sample applications demonstrating how you can use Mixpanel in your React Native app.

SimpleMixpanel: Integrate Mixpanel with a minimalist approach MixpanelDemo: A full Mixpanel API demo app ContextAPIMixpanel: Integrate Mixpanel with Context API

I'm closing this one now. Please feel free to reopen if you have any issues. Again, thanks so much for bringing it up.