Search code examples
reactjsmixpanel

mixpanel.track() returns undefined


I'm trying to implement mixpanel script into my react app.. as per the docs I've pasted the mixpanel snippet inside index.html inside the head tag & the token key is also set.

But i still get this msg shown below inside my mixpanel dashboard. enter image description here

In this tutorial we can trigger an event from console.log and can see the event in mixpanel dashboard but when i try to do the same mixpanel.track returns undefined.. instead it should have returned an object as shown in the video.

enter image description here

I then tried to follow this article from medium.. https://medium.com/@andrewoons/setting-up-mixpanel-in-react-3e4c5b8c2a36. but still no luck..


Solution

  • The main culprit is the browser settings..

    Go to browser settings > Privacy and security > Cookies and other site data

    Turn Off Send

    ‘Do Not Track’ request with your browsing traffic
    

    Enable

    Allow all cookies
    

    enter image description here

    This should fix the problem