Highlighted

How do I track iframes properly with Tealium (GA, etc)?

Rookie Contributor
We have any iframed page (iframe.demo.com) inside our website (www.demo.com). With Google Analytics you need to make sure the tracker inside the iframe is properly loaded to make sure it doesn't take the referrer for the regular website (www.demo.com). We don't want our referrers in this example to say www.demo.com. Is there a smart/ easy way to do this with Tealium?
3 REPLIES 3
Highlighted

How do I track iframes properly with Tealium (GA, etc)?

Employee Emeritus
Hey Martijn, Check out this the documentation on _setReferrerOverride https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking?cs... Currently this isn't built directly into the GA template so you'll need to set this through an extension. You can use something like: if(b['dom.referrer'].indexOf('demo.com')>-1){ _gaq.push(['_setReferrerOverride', 'NEW URL TO SET AS REFERRER']); } For Google Universal Analytics it would look like: ga('set', 'referrer', 'NEW URL TO SET AS REFERRER'); There is also a setting within Google Analytics where you can exclude referrers directly within the interface. Check out this article: https://support.google.com/analytics/answer/2795830?hl=en
Highlighted

How do I track iframes properly with Tealium (GA, etc)?

Rookie Contributor
Hi Jared, Thanks for sending me the info. To my understanding this would solve part of the solution. This technique suggests that the parent page GA code is loaded before the iframed page GA code does. What if the iframed code is loaded before the parent page code is loaded? Theoretically you would have to wait running the GA code in the iframe until the parent GA code is executed. With Tealium my GA code loads on DOMready, so the delay on the parent page could be there.
Highlighted

How do I track iframes properly with Tealium (GA, etc)?

Employee Emeritus
Hey Martijn, This is getting pretty specific. I would recommend reaching out to your Account Manager with a URL where we can see your set up. The tag will fire on DOM ready but it will load earlier on page load. So depending on where you are loading utag.js and when the iframe loads the above methods may still work without problem. Also, if you're using legacy GA that method will still work. You just need to change it to: if(b['dom.referrer'].indexOf('demo.com')>-1){ _gaq = _gaq || []; _gaq.push(['_setReferrerOverride', 'NEW URL TO SET AS REFERRER']); } Then when the tag does load it will just use the "_gaq" array that you previously set. Our team will be able to look deeper if we had a URL or an example of how your page is set up.