google analytics – for all subdomains

To be able to track all subdomains via one google analytics (f.e. if you have web page on www.domain.com and blog on blog.domain.com) you have to adjust GA code.

To achieve this, i’ve copied Ga.php Block to:

/app/code/local/Mage/GoogleAnalytics/Block

added this function:
protected function _getSubdomainCode()
{
return "_gaq.push(['_setDomainName', 'musstard.com']);\n";
}

and finally added extra code to protected function _toHtml()

you can download the final code here: Ga.php

Leave a Reply