Closed NateWilliams2 closed 3 years ago
Second this!
Hi @NateWilliams2, thanks for reporting this. The plugin should behave as you are expecting. We'll review this and come back to you asap.
Ok, I see why you're getting this behavior. I guess your adding the value to the stream just before sending the event. Take a look at the StreamController docs. As you can see there:
If sync is false, the event will always be fired at a later time, after the code adding the event has completed.
So, either you set the sync
argument to true, or you listen to the stream and just add the event once the change it's done.
Let me know if that solves your question and feel free to close the issue if it does.
Take into account that we have just released vesion 1.4.0 which adds a new setter called userId
. This is not a stream so you won't be having this sync issues.
//cc @Oriol-GG fyi
Thanks for the explanation!
I'll try out one or both of these solutions and report back if I'm still having issues.
Expected behavior
I may be misunderstanding the expected behavior, but my understanding is that with the setup
any time I call
The stream should trigger an event to provide a new user profile that uses this new user id. The use case for this is an app where a user can have multiple accounts, and each account needs a distinct analytics profile.
Actual behavior
In practice, however, it does not- I set up the initial user profile (eg.
_user$.add("aaaaaaa");
and mixpanel correctly tracks events with this profile. When I add a new user ID (eg._user$.add("bbbbbbb");
Mixpanel still reports that the events belong to profileaaaaaaa
. This happens both when using single and batch MixpanelAnalytics.I think a workaround to this problem is to dispose and re-initialize my
_mixpanel
variable each time the user profile changes. Please let me know if this is how the plugin was designed, or if this is indeed a bug. Thanks!