1. Home
  2. Docs
  3. Google Tag Manager Guide
  4. Google Tag Manager Practical Guide
  5. Subdomain Tracking

Subdomain Tracking

If you use the universal tracking code——analytics.js, which has include subdomain tracking turned on by default, you can use the tracking code directly, but you also need to configure something in Google Analytics, The following picture is the universal  tracking code:

Subdomain Tracking

The auto inside means that the cookie is automatically generated under the top-level domain, that is, the two sub-domains will share the cookies in the same top-level domain. For example, if your website address is blog.bbbccss.com,  analytics.js will set the cookie domain to bbccss.com,another website is new.bbccss.com, analytics .js will set the cookie domain to .bbccss.com, So if different subdomains deploy the same piece of tracking code, they use the same cookie, allows hits from all subdomains to share the same first-party cookie,

 

If you use the recommended JavaScript snippet that Google Analytics provides you, this is already set for you,We don’t need to make changes to the Google Analytics tracking code to use it directly:

Subdomain Tracking

If you are in Google Tag Manager, you need to do some configuration:

Subdomain Tracking

 

You can also use Google Analytics settings, which are enabled by default:

Subdomain Tracking

 

We  still  need to do some configuration in Google Analytics,In Google Analytics,Select “Admin” → “Tracking Info” → “Exclude Referral List” → “Add Referral List” ,and ensure that all domains added to the Exclude Referral List.

Subdomain Tracking

 

When a user jumps from one domain name to another, it will send a referral to Google Analytics. If it is different from its own website, it will generate a new session. The Exclude Referral List is to prevent the creation of a new session. After this setting, the user will not generate a new session when jumping in a different subdomain. What happens if there is no setting?

Take a look at the following example:

CookieDomain (Which means is set as auto)and referral traffic are not set: 2 users, 3 sessions will be recorded
If the cookie domain is set but the referral traffic is not set,:1 user, 3 sessions will be recorded.
If the cookie domain and referral traffic are both set,:1 user, 1 session will be recorded.

Therefore, subdomain configuration must be configured to exclude referral lists.

 


If you don't understand, You can leave a comment below or email me (haran.huang@ichdata.com).
Tags , ,
Was this article helpful to you? Yes No

How can we help?

Post my comment
Cancel comment
Expression Texture Bold Strikethrough Center Italic Sign in

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website