Here are the five steps to follow to get the most accurate data from a website with multiple subdomains:
Create a profile for your main site www.mysite.com in your GA account.
To track traffic across subdomains, you will need to add a line of code to your script called _setDomainName(). For example, if www.mysite.com contains subdomains, the code would look like the following:
Create a duplicate profile for each subdomain and name the profile with the subdomain name. (Note: Your “UA-XXXXXX-X” will be the same). Look for “+Add New Profile” on the GA Overview page.
Add a predefined filter to each duplicated profile. Look for “Edit” on the right side of the Overview page in the same line as the profile:
Then look for “+Add Filter”:
Now, add a filter only to include traffic to this particular subdomain:
If your subdomains contain URLs with the same request URI, you will need to do one more step. The request URI is everything that comes after the domain name on a URL – for example:
www.mysite.com/page1 – /page1 is the request URI. GA reports only show the request URI, and if the main site and subdomains contain the same request URI, you will not be able to differentiate the traffic for these pages.
To fix this, you will need to add an advanced filter to have GA show the full URL in the reports. Again, you will need to add a new filter:
So this is how you can track your website traffic if you have a site with multiple subdomains – you only need one GA account and one GA profile with many duplicated profiles with predefined filters.