Tracking subdomains with Google Tag Manager

Recently I am investigating how to track user behaviors across our digital services.

We have web applications like:

  1. (the company homepage)
  2. (digital service A)
  3. (digital service B)

and we are using Google Tag Manager (and Google Analytics)

To be straight forward, what we need are:

  1. Use Universal Analytics
  2. In tag settings of GTM, set cookieDomain‘s value to auto
  3. In Referral Exclusion List of GA, add
  4. Done

For trouble shooting, I recommend to install Google Analytics Debugger (A chrome extension).

To test it, you can

  1. go to
    Use GA debugger to find the GA clientId, e.g. 1753731437.1492367410, and
    It has a cookie _ga with value “GA1.2.1753731437.1492367410“, and the domain is: “
  2. Click a link to navigate to
    The GA clientID on Service A should be the same, and
    It has an identical _ga cookie: same value, same domain “”
  3. Directly type URL
    Again, the same GA clientID and _ga cookie

There some some great articles about this topic. The most useful posts that I found are from lunametrics (cross-domain tracking and sub-domain tracking with a great diagram), and from Simo Ahava (here and here) with deep core code explanation. A post from e-nor is also useful.

Share Comments