[英]Analytics cross domain iFrame tracking with Tag Manager
IFrame tracking has never been a problem while using Google Analytics directly inserted on to the page. 使用直接插入到页面上的Google Analytics(分析)时, iframe跟踪从未成为问题。 But now i started using Google Tag Manager to administrate scripts, i got an problem. 但是现在我开始使用Google跟踪代码管理器来管理脚本,但是遇到了问题。
function addGaIframe(ua_code, opt_hash) {
console.log("Add Ga");
//Check UA
console.log(ua_code);
return function(tracker) {
//Check Tracker
console.log(tracker);
window.linker = window.linker || new window.gaplugins.Linker(tracker);
ifrm = document.createElement("IFRAME");
ifrm.style.width = 100+"%";
ifrm.style.border = "none";
ifrm.frameborder = "0";
ifrm.allowtransparency = "true";
ifrm.id = "iframe_xx";
ifrm.src = window.linker.decorate("https://xxxxxxx.com/ua="+ua_code, opt_hash);
document.getElementById('iframe').appendChild(ifrm);
};
}
When i look in the console i can see that the tracker
is undefined 当我在控制台中查看时,可以看到tracker
未定义
Normally the tracker is an object like : 通常,跟踪器是一个类似以下的对象:
I hope that someone can help me with this problem. 我希望有人可以帮助我解决这个问题。
Just add, in "Fields to Set", allowLinker : 1
and add the domains which the iframes uses under Auto Link Domains
. 只需在“要设置的字段”中添加allowLinker : 1
然后在“ Auto Link Domains
下添加iframe使用的Auto Link Domains
。 It worked :) 有效 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.