My profiles on google analytics is http://example.com (don’t have www ). And this script on my site :
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-2']);
_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);
})();
Google Analytics will count view from subdomain.example.com ?
And a other question i want free google analytics ‘s cookies from static.example.com . I tried put _gaq.push(['_setDomainName', 'example.com']); But still see cookies on images from static.example.com on firebug.
If you have subdomains you should use the following code on every one of them:
But note that this will cause the cookies to be sent to the static subdomain as well. The best way to isolate the static domain is to have it as a different domain, not as a different subdomain. If you store the GA cookies on the full domain instead of the top domain you will clear the static domain but it will be much harder to correctly setup GA.