簡體   English   中英

Google Analytics(分析):跨域參數通過URL發送,但不通過報告傳遞源

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

這里還有另一個跨域跟蹤問題,我一生都無法解決。

我有2個獨立的域,並且它們之間使用_link方法。 我可以看到Google Analytics(分析)utm參數從一個域傳遞到另一個域,但是盡管如此,當我到達第二個域時,我被視為新訪客(使用Google Analytics(分析)調試器,我看到一個新的訪客ID和我的廣告系列/源/媒介信息已被domaina的引薦所取代。

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>

鏈接看起來像這樣: <a href="https://secure.domainb.com" onClick="_gaq.push(['_link', 'https://secure.domainb.com']); return false;">Donate Now</a>

當我單擊該鏈接時,將進入帶有所有GA URL參數的secure.domainb.com,但正如我所說,沒有源數據通過。

在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>

之前,我已經使用此設置成功實現了跨域跟蹤,這就是為什么我對此感到困惑的原因。

有什么想法嗎?

提前致謝。

您應該將第二個跟蹤器用於為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>

您應該使用對setDomainName的調用來定義域:

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

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

請注意,如果您使用多個級別的子域(即secure.www.domainb.com),請添加。 到setDomainName參數,如下所示:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM