Implementing Sub-domain Tracking

Contact Us or call 1-877-932-8228
Implementing Sub-domain Tracking

Implementing Sub-domain Tracking

The _setDomainName() Method

The _setDomainName method enables Google Analytics to pass cookie information across multiple sub-domains. Here is how you can use this method to track multiple sub-domains for a fictitious website called which has two sub-domains (e.g. and


This method should reference the primary domain (e.g.

Step 1: Modifying Your GATC for Sub-domain Tracking

You will first need to add the _setDomainName method within your GATC on all pages on all sub-domains of the site. You can either manually add this method into your existing GATC or you can grab the code for sub-domain tracking from your profile settings screen as shown in the following screen shot:

Adv Segment Default

Step 2: Sub-domain Tracking and Custom Filters

The above modification to your GATC will aggregate all the data from different sub-domains into a single profile. However, your reports may not distinguish between pages coming from versus For example, and will be reported as /index.html.

Apply the following filter to resolve this challenge:

Adv Segment Default

Once this filter is applied, Google Analytics will show the following outcome in the Top Content report in regards to the above example: