SNaushadS
SNaushadS

Reputation: 13

What approach to select for Tracking a Sub-Domain in Google Analytics

This is a new setup, no historical data.

My objective is to be able to track the domain, as well as sub-domain.

Setup that i have: domain.com - User generated content site sub.domain.com - E-Commerce Shop.

Create a New Property for sub.domain.com in addition to domain.com ? Or Create a Different View in the Property ?

To be precise, i need to know which method to select and why ?

Yes, there are previously asked questions over SO relating to "How to track sub-domains" but none show describing the reason to select an approach.

Upvotes: 1

Views: 512

Answers (2)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

This depends on your use case.

If the content of your subdomain is strongly connected to your main domain you probably want to use the same tracker for both without modifications. This will allow you to track user sessions that move between main domain and subdomain. You would either create a view to filter by subdomain, or simply create a filter that adds the subdomain to the page path (so you can discern Urls from the main and subdomain) and look at them in the same view.

If main domain and subdomain share a tracker and a cookie with the client id this has at least two implications. Users that have visited your main domain in one session and the subdomain in another will be recognized as recurring users. Also sampling in a free GA account happens on the property level, so if you track main domain and sub domain via the same tracking id sampling will occur more frequently (on sites with much traffic).

If you want to avoid either you should use separate GA properties for main domain and sub domain and maybe change the cookie domain for your subdomain (documentation for the current gtag.js is here).

Upvotes: 0

Rahul Jain
Rahul Jain

Reputation: 3141

Sub-domains are tracked automatically by Google Analytics you just need to set the Cookie-domain property to auto.

You can create a new view for your subdomain and analyze data only for that sub-domain that would be more efficient.

Let say you have a site named mydomain.com and have one blog for that also like blog.mydomain.com.So, for both you can have different views and one combined view then it's up to you how you want to analyze the data.

ga('create', 'UA-12345-1', 'auto');
// is the same as
ga('create', 'UA-12345-1', {'cookieDomain' : 'auto'});

Refer the below document for more information on tracking sub-domains. [https://support.google.com/analytics/answer/1034148?hl=en][1]

Upvotes: 1

Related Questions