简体   繁体   中英

Google Tag Manager - Tracking domain and subdomain

Can't find a clear solution to my problem anywhere.

I've got One website: www.example.com and a subdomain blog.example.com

I've created 2 containers using the same GA ID for both of them.

Then on the website I've got one global view (working with url from both sites) and I've tried to set up one view for the domain and one for the subdomain but no stats are coming. To do so, I've created filters: - on www.example.com, I have a filter excluding traffic from url beginning with blog.example.com - on blog.example.com, I have a filter including only traffic from url beginning with blog.example.com

I know on GA, you have to add to your tag:

`var pageTracker = _gat._getTracker('UA-12345-1');
pageTracker._setDomainName('example-petstore.com');
pageTracker._trackPageview();`

But as I'm using GTM, how can I do ?

Thanks

It looks like you're using the standard tracking. I would upgrade at least to asynchronous tracking, or better yet, upgrade to Universal Analytics . With GTM, it make it easy to include both ie dual-tag your site . Once you've upgraded, subdomain tracking is a bit easier.

I would use just one container for both the top domain, then you can manage your subdomains all within that container. (much easier to maintain).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM