Reputation: 107
I am using asynchronously loaded mixpanel. On my homepage there are some mixpanel track calls which get fired before mixpanel js file gets loaded so those calls get mixpanel variable undefined. How to send those tracking calls?
Upvotes: 0
Views: 3841
Reputation: 1417
In my apps I'm waiting when mixpanel is initialized and only then started to use it:
mixpanel.init('yout app key', {
loaded: function () {
setTimeout(function () {
//do your action here
}, 1);
}
});
You could broadcast some event on 'body' after init and call some track functions when event is triggered.
Upvotes: 0