Solved

Getting data from Javascript

  • 5 January 2021
  • 2 replies
  • 59 views

As all Analytics libraries, adding Mixpanel and tracking events should be a breeze. But unfortunately after trying both the snippet and the npm library, of course initializing the library with the copied id from the setup page and tracking events, there is no way to see any event.

Tried debug:true both localhost and deployed and nothing appears in the console either.

import mixpanel from 'mixpanel-browser';

mixpanel.init('XXX', {
debug: true
});

mixpanel.track('Start up'); // to make sure I get something

How can I debug this? I went through this basic troubleshooting page.

For npm I used a third party library for the types but logging mixpanel all seems correct (I also got an error when I forgot to initialize it)
 

If debug was showing something in the console it could have been because of the project id which I copied as it is. But it seems more like the library is broken.

The track method returns undefined and its callback returns 0.

icon

Best answer by Josh 5 January 2021, 17:02

Turned out it was the browser “Do not track” setting, which I can’t recall of having it enabled it (maybe an adblocker did?) https://support.google.com/chrome/answer/2790761

 

For anyone else who runs into this problem, you can ignore the browser’s “do not track” using the “ignore_dnt” config option in the JS lib:

mixpanel.init(TOKEN, {ignore_dnt: true})

 
View original

2 replies

Turned out it was the browser “Do not track” setting, which I can’t recall of having it enabled it (maybe an adblocker did?) https://support.google.com/chrome/answer/2790761

Turned out it was the browser “Do not track” setting, which I can’t recall of having it enabled it (maybe an adblocker did?) https://support.google.com/chrome/answer/2790761

 

For anyone else who runs into this problem, you can ignore the browser’s “do not track” using the “ignore_dnt” config option in the JS lib:

mixpanel.init(TOKEN, {ignore_dnt: true})

 

Reply


Mixpanel