Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixpanel javascript integration: consecutive events are recorded in wrong order at mixpanel end

I am recording two events in a web page

  1. Register
  2. Plans complete

Those two events are recorded in that page as the user can register and complete the process (the user registration internally handled in the form submission and records it in the complete page). Those events recording JS code is in consecutive line in above order.

Those events related mixpanel.track function calls are issued in order. The issue is sometimes the Plan complete event recorded before the Register in the server. I have inspected the Mixpanel's live view and notice that this happens randomly with a probability of 0.1 approximately.

I want to know if there is a way to overcome this issue by setting a order number or local time stamp or any other way.

My environment is :

  • Mixpanel: JS library
  • Browser: chrome in windows 7
like image 958
Shantha Kumara Avatar asked Jan 28 '15 11:01

Shantha Kumara


1 Answers

First please add a snippet of your mixpanel calls. But if you are just firing the second event in code without user input just call the second mixpanel.track('event2') in a callback for the first call.
ex.:

mixpanel.track('event1', function(result){
    mixpanel.track('event2');
};
like image 151
Hasen Avatar answered Oct 13 '22 07:10

Hasen