react-native-mixpanel
react-native-mixpanel copied to clipboard
Multiple Mixpanel instances
Hey all, I have a situation where we have to log events to 2 mixpanel projects at once. In case you are wondering, the reason is our old mixpanel system got mangled over the years and we are starting a fresh one for our marketing team.
Anyway, we use this wonderful package in our app but it is limited to a single mixpanel instance. I think with a little work, multiple mixpanel instances could be supported. I was thinking that the API could work like this: Normal:
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN)
Multiple instances:
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN)
Mixpanel.namedInstanceWithToken('second',YOUR_SECOND_PROJECT_TOKEN)
Then you could specify the instance in each event like so:
Mixpanel.track('Event name', 'second')
This is a rare use case, I know. But it's the situation I'm in and I would love to make it available to people and avoid using a fork forever. If I created the PR and everything was tight, is this something you would consider? Thanks!
@StevePotter that's awesome!