Note that this snippet has to be inside the <body>
for it to work — it won’t work when included in the <head>
. Also, in IE6, it would cause a security warning in IE6 for HTTPS pages.
Do what you want with this code, but please don’t use it. Use the more robust optimized Google Analytics snippet instead.
This snippet breaks the “no globals!” rule, but then again ga.js
relies on the global _gaq
variable.
i also think you could save bytes and make this more useful by passing the
UA-XXXXX-X
id as a parameter.