GA -仅为子域设置统计信息

GA - set up statistics for subdomain only

本文关键字:设置 统计 信息 GA      更新时间:2023-09-26

问题是-我需要单独跟踪子域。因此,我在subdomain.doman.com上创建了单独的跟踪器。但是Google分析提供了这个代码

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'XXXXX']);
  _gaq.push(['_setDomainName', 'domain.com']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

它不工作,当我把它放在subdomain.domain.com…我应该改变_gaq。push ([' _setDomainName ', ' domain.com ']);行
_gaq.push(['_setDomainName', 'subdomaindomain.com']);我计划只跟踪那个子域。

嗯,我这边也有类似的设置。

或者你可以在你现有的web属性中创建一个新的配置文件,并设置一个包含来匹配那个主机名。

另一个解决方案是使用Google标签管理器通过触发规则在特定主机上部署给定的GA片段。