How to install Google Analytics on a site with sub domains or 301 redirects

domain redirected to directory of other domain

If the domain you enter into Google Analytics is different than where the Joomla site actually resides, you may need to alter the Google Analytics code to make it work.

Say you have a domain and a points to, is re-directed to another site or sub domain, all you need to do is add one line of code to the Google Analytics code which you put in your Joomla site.

Just add: pageTracker._setDomainName("none");

after the line: var pageTracker = _gat._getTracker("UA-12345-1");

This tell Google Analytics that the actually site may not be on that domain and don't worry its safe, it comes from Google Analytics themselves.

More information about this can be found from Google Analytics help.

Posted in You too can (how to articles)