74
rated 0 times
[
81]
[
7]
/ answers: 1 / hits: 46314
/ 14 Years ago, mon, march 29, 2010, 12:00:00
The Async Tracking code in Google Analytics looks like this:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
About The first line:
var _gaq = _gaq || [];
I think it ensures that if _gaq
is already defined we should use it otherwise we should an array.
Can anybody explain what this is for?
Also, does it matter if _gaq
gets renamed? In other words, does Google Analytics rely on a global object named _gaq
?
More From » google-analytics