IFrame tracking使用直接插入到页面的 Google Analytics 从来都不是问题。 但现在我开始使用 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);
};
}
当我查看控制台时,我可以看到跟踪器
未定义
通常跟踪器是一个像这样的对象:
希望有人能帮我解决这个问题。
最佳答案
只需在“要设置的字段”中添加 allowLinker : 1
并在自动链接域
下添加 iframe 使用的域。
它起作用了:)
关于javascript - 使用跟踪代码管理器分析跨域 iFrame 跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32221342/