Reputation: 401
I have created a simple react app, and I try to send some events to mixpanel.
However nothing is sent. No api requests are shown in network console, when mixpanel.track('test') is called.
when mixpanel.init('token') is called, I receive this response:
{"notifications":[],"config":{"enable_collect_everything":false}}
this is my index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
let mixpanel = require('mixpanel-browser');
mixpanel.init('my-secret-token');
mixpanel.track('test');
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
I have initialized my react app by create-react-app, and installed mixpanel-browser module.
I also have created mixpanel project, and triple checked that token.
Any ideas what I am doing wrong?
Upvotes: 3
Views: 7560
Reputation: 4122
Anything that stops tracking can be the cause - Adblock is one possibility.
Another one is "Do not track" setting enabled on your browser.
There may be other plugins which you might have installed to avoid websites tracking you.
Upvotes: 14
Reputation: 136
Do you have any adblocker?
I had the same issue and the problem was the uBlock chrome extension. Some adblockers prevent Mixpanel from loading on your page. To avoid this, I moved all the important events to the backend.
Here you have the Mixpanel information about adblockers:
https://help.mixpanel.com/hc/en-us/articles/115004499463-Ad-Blockers-Affect-Mixpanel
Upvotes: 0
Reputation: 401
Ok, it seems to have something to do with my chrome browser. When using safari, everything works fine, but with chrome nothing is sent.
macOS: high sierra, 10.13.6 (17G65) chrome version: 68.0.3440.106
Upvotes: 6