1

IFrame tracking has never been a problem while using Google Analytics directly inserted on to the page. But now i started using Google Tag Manager to administrate scripts, i got an problem.

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

enter image description here

Normally the tracker is an object like :

enter image description here

I hope that someone can help me with this problem.

Thomas Bolander
  • 3,892
  • 3
  • 22
  • 30

1 Answers1

0

Just add, in "Fields to Set", allowLinker : 1 and add the domains which the iframes uses under Auto Link Domains. It worked :)

Thomas Bolander
  • 3,892
  • 3
  • 22
  • 30