Closed cristiannicola123 closed 6 years ago
it looks like this is because some other library in the website does a
window.ga = window.ga || function () { }
analytics code could probably check if the ga has been properly created & initialised instead of just check window.ga is assigned.
... a customer has reported events missing from their google analytics reports and after lots of time investigating this i have reached the point of finding a race condition.
by refreshing a page a few times (it takes on average about 50 or so clicks, so dont give up too quick) i can see that :
normal expected network logs are:
when the race condition happens
manually creating the ga with a
ga.create('UA-xxxx-1', 'auto')
will flush the analytics queue and events get send ok.segment calls all are ok in either case, so i suspect the "loaded" function does not work as it was designed to...