You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
Why -> #5 (comment)
How -> Mixpanel multi-event
Logic: something like this needs adding into the send() method before we turn them into requests
vartemp=[];/** * to reduce network requests, we batch up events in sequence into one request (50 per batch) * https://developer.mixpanel.com/reference/events#track-events-in-batch * event batching logic * -------------------- * is this an event? * - yes * - was the previous request a batch with less than 50? * - yes * - append to previous request * - no * - is the next request an event? * - yes * - make this a batch request * - no * - process this event as normal * - no * - process this event as normal */for(vari=0,l=items.length;i<l;i++){// is this an event?if(items[i].event){// is the previous item an event batch with less than 50?if(temp[i-1]&&Array.isArray(temp[i-1])&&temp[i-1][0].event&&temp[i-1].length<50){// append to previous batchtemp[i-1].push(items[i]);}// is the next item an event?elseif(temp[i+1]&&temp[i+1].event){// make this one a batch in prep for the nexttemp.push([items[i]]);}// otherwise, process as single eventelse{temp.push(items[i]);}}// otherwise, append as normalelse{temp.push(items[i]);}}
We also need to be mindful of how we clean up (remove) successful events posted to Mixpanel. At the moment, it's cleaning them up by going through the requests one at a time checking for __completed. That will no longer work if 50 events are sent at once
The text was updated successfully, but these errors were encountered:
Why -> #5 (comment)
How -> Mixpanel multi-event
Logic: something like this needs adding into the
send()
method before we turn them into requestsWe also need to be mindful of how we clean up (remove) successful events posted to Mixpanel. At the moment, it's cleaning them up by going through the requests one at a time checking for
__completed
. That will no longer work if 50 events are sent at onceThe text was updated successfully, but these errors were encountered: