Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Tag Manager进行跨域iFrame跟踪分析_Javascript_Iframe_Google Analytics Api_Google Tag Manager_Google Analytics Sdk - Fatal编程技术网

Javascript 使用Tag Manager进行跨域iFrame跟踪分析

Javascript 使用Tag Manager进行跨域iFrame跟踪分析,javascript,iframe,google-analytics-api,google-tag-manager,google-analytics-sdk,Javascript,Iframe,Google Analytics Api,Google Tag Manager,Google Analytics Sdk,使用直接插入页面的Google Analytics从来都不是问题。 但现在我开始使用谷歌标签管理器来管理脚本,我遇到了一个问题 function addGaIframe(ua_code, opt_hash) { console.log("Add Ga"); //Check UA console.log(ua_code); return function(tracker) { //Check Tracker console.l

使用直接插入页面的Google Analytics从来都不是问题。 但现在我开始使用谷歌标签管理器来管理脚本,我遇到了一个问题

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使用的域。
它起作用了:)

只需在“要设置的字段”中添加
allowLinker:1
,并在
自动链接域下添加iFrame使用的域。
成功了:)