Open romreed opened 6 years ago
It looks like I have the same issue with the latest version of react-native-mixpanel (1.0.2). Have you solved the issue in the meanwhile @romreed?
Additional Note:
@natterstefan Hi. No but i write like this Mixpanel.trackWithProperties("main success", obj: { thirst:1, second:2, }, ) //work
in obj i push all data i need. Don't use more then 1 key after " , ". I hope that in the future this bug will be fixed.
@romreed Ok. What I see is that (independent from the latest react-native release 0.55.4) version 1.0.2 does not send any track data to Mixpanel when using trackWithProperties. But it does when I downgrade to 0.0.16 (what I eventually do now).
Does this happen to you as well when you downgrade again?
@natterstefan downgrade don't help me.
I also get the following error when using Mixpanel.track
==>
Error: Error: Mixpanel instance was not initialized yet. Please run initialize() and wait for its promise to resolve before calling track(...)
But all I do is
Mixpanel.sharedInstanceWithToken(mpProjectToken);
Mixpanel.track('test')
I will further look into this and keep this post updated.
@natterstefan try make this
Mixpanel.sharedInstanceWithToken(mpProjectToken).then(()=> Mixpanel.track('test') )
@natterstefan i use like this
Mixpanel.sharedInstanceWithToken("token") .then(() => Mixpanel.identify(getUniqueID)) .then(() => Mixpanel.set({"$name": DeviceInfo.getDeviceName()}))
Thanks @romreed, makes sense I will try it. But it is not stated in the Readme though that sharedInstanceWithToken
is returns a promise
@natterstefan i open shareInstanseToken in android saw return promise.You are right.
If anyone is having issues with trackWithProperties it may be cause by an API update which now has track handle causes with and without properties.
track(event: string, properties?: Object): Promise<void> {
if (!this.initialized) throw new Error(uninitializedError('track'))
if (properties) {
return RNMixpanel.trackWithProperties(event, properties, this.apiToken)
} else {
return RNMixpanel.track(event, this.apiToken)
}
}
You can find this at line 60 in index.js https://github.com/davodesign84/react-native-mixpanel/blob/master/index.js
Hi, i have problem. I try to use trackWithProperties but nothing happened. Maybe i made some thing wrong.
import Mixpanel from "react-native-mixpanel" Mixpanel.sharedInstanceWithToken(yourToken) Mixpanel.track("test") //work Mixpanel.trackWithProperties("main success", { phone: phone, }) //work Mixpanel.trackWithProperties("main error", { error: error, token: token, test:"123" }) //not work