5.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Tracking Subdomains

[ Edited ]
Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

Hello All,


Hopefully this is the right spot.


We are about to create subdomains for some branches of our main domain, sub.domain.com and sub1.domain.com.


What do you think the best way to track these (they all have the same main domain).  I can set the tags and triggers in GTM for each one (we will have quite a bit of them), but that seems cumbersome and harder to track.


I am sure cross domain tracking is the way to go from the main domain, but what are your thoughts on the best practices to set this up.  Also, is there a way to upload data with the whole list of those subdomains?


Any links to how it would look in Google Analytics on our main domains account.  And one more (I really appreciate it) am I able to give separate people to be able to see the analytics for just that particular subdomain.


Thank you so much, everyone here has been so helpful.


p.s.  One other thing.  These branches WANT to stay a separate entity from the main domain because they operate individually.  Yes they under our moniker, but act as their own business.  Not sure if that helps.  So referral traffic is not a problem from the subdomain to the main domain, there will not be links back to the main site or from subdomain to subdomain.

1 Expert replyverified_user
Marked as Best Answer.
Accepted by Bronwyn V (Top Contributor)

Tracking Subdomains

Rising Star
# 2
Rising Star

Hey Brett,


You do not need cross domain tracking as all of the traffic exists on the same TLD.  Cross domain is for when the traffic goes to a different top level domain (TLD). 


All you need to do to track sub-domains with GTM is make sure your container code is there.  Absolutely no customization is needed.


Now to your use case... you need to give people access to their own data.  So now we have a different issue as all the traffic will stay on the sub-domain and wont travel to and fro.


In this case, you can create views for each sub-domain by using a hostname filter and then you can give access to each group to their own view.  This has limitations; however, as you can only create 25 views per property and 50 properties per account.  


Is that enough?  If so have at it.   Since this sounds like a "franchise" situation, you may want to use individual properties for each - which would allow them at some point to be moved to a new GA account (more flexibility for the future) and this would give you the ability to add up to 50 to your account.  If that's not enough, then you could do multiple accounts.


I recommend that you dual track the sub-domains.  The first tracker would be the existing tag with no changes (as long as you have not declared the cookie domain to anything other that auto). 


And the second tracker would contain a lookup table that matched the hostname (sub-domain) to the correct anayltics property.  That way you don't need to set firing rules for each sub-domain and you can track pageviews with two tags only.




Theo Bennett

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn