How to track subdomains in Google Analytics with a single account


Sometimes is necessary and useful to track in a single Google Analytics profile different subdomains like in the case below:

  • www.myweb.com
  • it.myweb.com
  • es.myweb.com
  • and so on…

To make this work you need to follow 2 simple step:

#1 – Create a filter on your profile

This step is very simple and it’s necessary to make analytics show the url full path.

Track subdomain google analytics

Simply replicating the above filter you will enable showing all your sub-domains.

#2 – Modify the tracking code for all sub-domains

Modify your tracking code everywhere as follow:

//Tracking code customizations only
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setDomainName', '.myweb.com']);
_gaq.push(['_trackPageview']);

Related guidelines

Scritto il


Sei membro del forum? Vuoi scrivere anche tu su LOGOALT
Chiedilo a @giorgiotave