Solved

Using Mixpanel with ReactJS

  • 13 February 2019
  • 8 replies
  • 6311 views

Badge

Would really like the ability to use Mixpanel with ReactJS without having to worry about forgetting dev checks when calling track or identify, or solving this with a a wrapper function that calls Mixpanel during the user authentication/sign up.


icon

Best answer by cherise 16 December 2020, 19:52

View original

8 replies

Badge

Hi @amrshafik! Have you considered using https://www.npmjs.com/package/react-mixpanel?


Userlevel 1
Badge

I use redux. Every time when I dispatch an action I record it with mixpanel. I also use meta field for non payload values but important for mixpanel.


Badge

I have used redux. Every time when I dispatch an action I record it with mixpanel. I also use meta field for non payload values but important for mixpanel.


Badge

The best way to use mixpanel with react applications is by using redux, this way all the actions triggered within your app will be capture by mixpanel, you can blacklist and whitelist actions/events to be sent to mixpanel via a middleware.

https://github.com/neciu/react-mixpanel (React)
https://github.com/danscan/rn-redux-mixpanel (React-Native)


A handy library has recently appeared for thishttps://www.npmjs.com/package/react-mixpanel-provider-component

 

Userlevel 6
Badge +3

@spiehdid — thanks for sharing!

Userlevel 6
Badge +3

We are excited to announce that we have shipped the React Native SDK!

Please use the following resources to use the SDK, and post in Sending data to Mixpanel if you have any questions!

Developer guide: https://developer.mixpanel.com/docs/react-native

Github link: https://github.com/mixpanel/mixpanel-react-native

Sample App: https://github.com/mixpanel/mixpanel-react-native/tree/master/MixpanelDemo

The accepted answer is incorrect, the original question was about ReactJS, whereas the answer points to React Native, a different technology.

Reply