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
Normally the tracker is an object like :
I hope that someone can help me with this problem.