4 ms·
Only if everyone loads it the same way. But there are lots of different ways to load GA; the only reason _gaq.push() isn't scary and doesn't raise the specter o
by yahelc 14y ago
Only if everyone loads it the same way. But there are lots of different ways to load GA; the only reason _gaq.push() isn't scary and doesn't raise the specter of race conditions is because of the 'spoofing' GA does.
There are LOTS of different versions of the GA snippet floating around the internet; the assumptions this configuration makes would only work for some of them.
For example, some people load GA like this:
<script async src="//google-analytics.com/ga.js"> </script>
<script>
var _gaq = _gaq || [];
...
</script>
Folks who do this will break at minimum with older browsers that don't support async; not sure what it would do with async support, though.
It seems unnecessarily risky.
- deleted 14y ago[deleted]
- danmaz74 14y agoOk, now I understand what the issue is. I guess a good solution would be to pass _gaq to my library initializer and push every value with a for cycle, instead of using concat. Thanks for the tip.