facebook google plus twitter
Webucator's Free Advanced Google Analytics Tutorial

Lesson: Multiple Domain Tracking

Welcome to our free Advanced Google Analytics tutorial. This tutorial is based on Webucator's Advanced Google Analytics course.

In this lesson, you will learn the basics of custom variables and how to develop your own for your website.

Lesson Goals

  • Fundamentals of Multiple Domain Tracking.
  • How to Track Across Sub-domains.
  • How to Track Across Cross-domains.
  • How to Organize Your Data Using Filters.

Introduction to Multiple Domain Tracking

Domain 101

Domain name refers to a hostname -- for example, www.example.com and www.mysite.com are different domain names. Each domain name represents a numeric IP address on the Internet. DNS helps in mapping a domain name with its respective IP address on the Internet.

Sub-domain is a part of the parent domain for example, secure.mysite.com or blogs.mysite.com will be considered as sub-domains for mysite.com. Sub-domains have their individually qualified hostnames.

Why and When to Use Multiple Domain Tracking

Google Analytics uses first party cookies and thus under the default configuration Google Analytics can't track across sub-domains or across distinct domains. You will need to configure Google Analytics such that the cookie information will be transferred from one domain to another.

Here is why you may want to use multiple domain tracking:

  1. Your parent website has different sections, each of which is represented by different sub-domains (e.g. sales.mysite.com and partners.mysite.com). In this case, you will need to implement sub-domain tracking in Google Analytics.
  2. Your website redirects your visitors to a separate checkout website to complete their purchases. In this case, you will need to implement cross-domain tracking in Google Analytics.

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 www.mysite.com which has two sub-domains (e.g. sales.mysite.com and partners.mysite.com).

_gaq.push(['_setDomainName','.mysite.com']);

This method should reference the primary domain (e.g. mysite.com).

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 mysite.com versus sales.mysite.com. For example, mysite.com/index.html and sales.mysite.com/index.html 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:

mysite.com/index.html

sales.mysite.com/index.html

Implementing Cross-domain Tracking

The _setAllowLinker( ) Method

In addition to the _setDomainName method, you will need the _setAllowLinker method to enable cross-domain tracking within Google Analytics. This method allows different websites to share the cookie information via URL parameters. The syntax is as follows:

_gaq.push(['_setAllowLinker', true]);

Step 1: Modifying Your GATC for Cross-domain Tracking

You will first need to add the _setDomainName and _setAllowLinker methods into your GATC on all pages for both websites.

For cross-domain tracking, use the following parameter to configure the_setDomainName method:

_gaq.push(['_setDomainName', 'none']);

You can either manually enter these methods into your existing GATC or you can grab the GATC code for cross-domain tracking from your profile settings screen as shown in the following screen shot:

Adv Segment Default

Step 2: The _link( ) Method

The _link() method enables Google Analytics to pass the cookie information across different domains (e.g. mysite.com and oursite.com) using URL parameters. Here is how you can use this method to modify your outbound links which are sending traffic from www.mysite.com to www.oursite.com.

<a href="http://www.oursite.com" onclick="_gaq.push(['_link', 'http://www.oursite.com']);return false;">Go to our site </a>

Step 3: Cross-domain Tracking and Custom Filters

In Google Analytics, reports will only include the requested URI from the respective domains and you will not see the host name associated with each URI. 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 section:

www.mysite.com/index.html

www.oursite.com/index.html