简体   繁体   English

Google Analytics(分析):跨域参数通过URL发送,但不通过报告传递源

[英]Google Analytics: Cross-domain parameters sent in URL but not passing source through reports

Another cross-domain tracking issue here, I can't for the life of me figure out this one. 这里还有另一个跨域跟踪问题,我一生都无法解决。

I have 2 separate domains, and I'm using the _link method between them. 我有2个独立的域,并且它们之间使用_link方法。 I can see the Google Analytics utm parameters get passed from 1 domain to the other but despite that, when I reach the 2nd domain I'm being counted as a new visitor (using Google Analytics debugger I see a new visitor ID and my campaign/source/medium info has been replaced by a referral from domaina). 我可以看到Google Analytics(分析)utm参数从一个域传递到另一个域,但是尽管如此,当我到达第二个域时,我被视为新访客(使用Google Analytics(分析)调试器,我看到一个新的访客ID和我的广告系列/源/媒介信息已被domaina的引荐所取代。

Code on domaina.com: domaina.com上的代码:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-111111"]);
_gaq.push(["_setDomainName", "none"]);
_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);
})();

</script>

And the link looks like so: <a href="https://secure.domainb.com" onClick="_gaq.push(['_link', 'https://secure.domainb.com']); return false;">Donate Now</a> 链接看起来像这样: <a href="https://secure.domainb.com" onClick="_gaq.push(['_link', 'https://secure.domainb.com']); return false;">Donate Now</a>

When I click that link I get taken to secure.domainb.com with all the GA URL parameters attached but like I said, no source data passed through. 当我单击该链接时,将进入带有所有GA URL参数的secure.domainb.com,但正如我所说,没有源数据通过。

Code on secure.domainb.com (I don't have direct control over this, note that there are 2 UA codes on this page, mine being the second listed): 在secure.domainb.com上的代码(我对此没有直接控制权,请注意,此页面上有2个UA代码,我的是第二个列出的UA代码):

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(["_setAccount","UA-222222"]);
_gaq.push(["_trackPageview"]);
_gaq.push(["_setAccount","UA-111111"]);
_gaq.push(["_setAllowLinker",true]);
_gaq.push(["_setDomainName","none"]);
_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);
})();

</script>

I've successfully implemented cross-domain tracking with this setup before, that's why I'm baffled why this isn't working. 之前,我已经使用此设置成功实现了跨域跟踪,这就是为什么我对此感到困惑的原因。

Any thoughts? 有什么想法吗?

Thanks in advance. 提前致谢。

You should use a second tracker for the second pageview being generated for secure.domainb.com. 您应该将第二个跟踪器用于为secure.domainb.com生成的第二个综合浏览量。

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(["_setAccount","UA-222222"]);
_gaq.push(["_trackPageview"]);
_gaq.push(["t2._setAccount","UA-111111"]);
_gaq.push(["t2._setAllowLinker",true]);
_gaq.push(["t2._setDomainName","none"]);
_gaq.push(["t2._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);
})();

</script>

You should define the domains using the call to setDomainName with: 您应该使用对setDomainName的调用来定义域:

_gaq.push(["_setDomainName","domaina.com"]);

and

_gaq.push(["t2._setDomainName","domainb.com"]);

Please note that if you are using more than one level of subdomains (ie secure.www.domainb.com), append a . 请注意,如果您使用多个级别的子域(即secure.www.domainb.com),请添加。 to the setDomainName argument, like this: 到setDomainName参数,如下所示:

_gaq.push(["t2._setDomainName",".domainb.com"]);

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

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