This is barely even a question, I’d just like someone to confirm this for me! 🙂
Google Analytics has generated my tracking code for the subdomain sub.mysite.com. A line of the tracking code looks like this:
_gaq.push(['_setDomainName', '.mysite.com']);
Do I need to change .mysite.com to sub.mysite.com? The tracking code page auto generates instructions for cases like these, but it mentions nothing about actually configuring it. I mean, does it detect the subdomain automatically, or am I being thick?
Cheers!
Jack
_gaq.push(['_setDomainName', '.mysite.com']);(note the.beforemysite.com) causes the tracking to take place on all subdomains ofmysite.com. See the documentation for_setDomainNamein the Google Analytics Tracker API.If you only want to enable tracking for
sub.mysite.com, you can just use this instead:P.S. You might also be interested in my post on optimizing the asynchronous Google Analytics snippet in terms of byte size and performance.