Tracking multiple domains through a single Google Analytics account

Tracking multiple domains through a single Google Analytics account


Data accuracy is crucial in gaging a website’s performance through Analytics statistics. If you are a webmaster who has multiple domains/subdomains and want to track the performance of all them, you can do so through a single Google Analytics account. Here’s how to do it:

Let’s assume you have three domains –, and
and want to track the performances of all these through a single Analytics account.

Step 1: Create separate Google Analytics accounts for the domains. For instance, let’s presume the different accounts are UA-AAAAAAA-1, UA-BBBBBBB-1 and UA-CCCCCCC-1

Step 2: Now, create a single overall account which can show the details of all the three domains. Let’s assume this is example account id for the overall tracking account – UA-ddddddd-1.

Use the below script and create Page Tracker variable for UA-AAAAAAA-1 account (with all its subdomains) and also create the overall tracker variable as UA-ddddddd-1 for the overall account.

<script type=”text/javascript”>
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src='” + gaJsHost + “’ type=’text/javascript’%3E%3C/script%3E”));
<script type=”text/javascript”>
try {
var pageTracker = _gat._getTracker(“UA-AAAAAAAA-1”);
var overallTraker = _gat._getTracker(“UA-ddddddd-1”);
catch(err) {}

Methods to be used from ga.js API

setDomainName: This method will set the cookie for the domain. Put “” as the argument to get the cookie details for all the subdomains of

setAllowHash: The value here would be set as ‘True’ by default. However, to track multiple subdomains, set the value as ‘False’. Only when the code is set as ‘false’, you will be able to track all subdomain activity.

setAllowLinker: This method is for cross domain user tracking. By default it is set as ‘false’ to stop passing of any link query string through the cookie. However, to pass the link query string to the next page, set the value as ‘true’.

Note: Replace UA-AAAAAAAA-1 with the remaining two accounts (UA-BBBBBBBB-1 and UA-CCCCCCC-1). In the same way, replace with and for tracking subdomain details of and .

Step 3: Repeat Step 2 coding for the remaining two domains and track them too in the overall account.

Step 4: Set the filter conditions in the custom filter with the advanced options as given in the screenshot below:

create filter for multiple domain

You will get domain name or subdomain details together or separately in the Analytics report depending on how you set the Fields. If you set Hostname for both Field A and B, you will get the full content performance of Home.aspx only. Instead, if you set Request URI to Field B, you will get the subdomain details separately as in the following screenshot.

final result after filter

For further information on how to do multiple domain tracking through a single Analytics account, visit

, ,

Open chat
Chat with our Experts!
Can I help you?