According to the documentation, Google Analytics asynchronous tracking code is "asynchronous" in the sense that you can push
items to the _gaq
array before ga.js is loaded. Once it is loaded, push
calls are executed immediately:
At this point, _gaq is no longer an Array, but an [Analytics] Object, and instant execution of the tracking methods is possible.
Does this mean that calling push
in onclick (after ga.js is loaded) can block my other code until the call is complete? Or is it really asynchronous? In this case, can navigating away from my page prevent the call to push
from completing?