简体   繁体   English

Google跟踪代码管理器-跟踪域和子域

[英]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 我有一个网站:www.example.com和一个子域blog.example.com

I've created 2 containers using the same GA ID for both of them. 我创建了两个使用相同GA ID的容器。

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. 然后在网站上,我有一个全局视图(使用两个站点的url),并且尝试为该域设置一个视图,为子域设置一个视图,但是没有统计信息。 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 为此,我创建了过滤器:-在www.example.com上,我有一个过滤器,排除了以blog.example.com开头的url中的访问量-在blog.example.com上,我的过滤器仅包含了来自url的访问量以blog.example.com开头

I know on GA, you have to add to your tag: 我知道在GA上,您必须添加代码:

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

But as I'm using GTM, how can I do ? 但是,当我使用GTM时,该怎么办?

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 . 我至少会升级到异步跟踪,或者更好的是,升级到Universal Analytics With GTM, it make it easy to include both ie dual-tag your site . 借助GTM,可以轻松地同时包含这两个内容,即对您的网站进行双重标记 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). (更容易维护)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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