Comments 48

  • These iFrames… such a pain to implement tracking for them.

  • Can this technique be used to track framesets?

  • What if the user comes onto the parent site from a cpc or email campaign, does some iframe interaction etc and then leaves. Surely the iframe interaction will not know it's the same user of the parent frame and all tracking will be lost (different client IDs and UTM parameters lost)? Is there a way to keep all tracking between iframe and parent frame?

  • Thanks Jullian, was desperately waiting for iframe tracking solution. Appreciated !!

  • Hi!
    I have one more question.
    Could you explain how to track event which includes 2 or more steps?
    Example:
    There are some cards of goods on a site like your test site. The 1st action is open pop-up with good, the 2nd action, which needs to track, is send a form. The form is the same for different goods, so I can't note it like a unique event. If the user only opens a good’s card event mustn’t track.
    I want to track from which product card’s form was sent.
    How can I realise this option without custom HTML?

  • Hi Julian, thank you so much for this, the tutorial is great! I just have a couple of questions after watching this. Currently, I have a parent GTM account attached to my website. If I create a separate GTM account for tracking my form can I inject 2 GTM codes on the one page? Also, should I create a separate GTM account for all of the forms and buttons I plan on creating events for? Let me know!

  • I really wish all of the built-in variables were enabled in the container by default. I work with a lot of different containers and always have to cancel setting up the trigger because I forgot to enable them first. Oh well. Maybe some day they will be. I wonder if maybe there's a reason they don't have them enabled by default…

  • This is so useful, Julian, thank you. Would you happen to have a link to the postMessage and listener code you created by any chance? Once again, your videos are so helpful. Thank you.

  • Great tutorial. I wish there was a way of doing this with all iframes. Most of the time I come across frames from 3rd parties; scheduling applications, lead gen apps etc. Might just be time for those companies to catch up to 2018 tech and stop all the iFraming.

  • Hello, thanks for the video. Could you share please those libraries to track the I frame and it is possible to track a pixel image to do that, for example, if the buy happens inside an Iframe.

  • I've been searching for weeks for this exact method. QUESTION, does the parent GA variable need to have cross-domain tracking set up on the iframe? It didn't look like that was the case. Please confirm. 🙂

  • I have implemented Event tracking for form submission using CDT and the same GTM account/container. It does seem to work. Why is the method in the video to be preferred, or is it? Am I missing something here?

  • In an instance where you are trying to track a form submit in an iframe as a conversion in Google AdWords (Yes, I have access to the iframe). Would you set it up like this then import it into AdWords? or can you push it directly into AdWords?

  • If you are using a 3rd party service for forms that you have access to the form html at least, can you do the same thing but just use the body gtm snippet? And do all the rest that you went over in the video?

  • Is there is a WordPress install on the site I could treat that WordPress like the Iframe and send the event to other GTM

  • does this also work with 2 iframes? I have a configurator implemented on a website and this configurator works with 2 iframes (webpage > iframe > iframe). i need so send the data/events from the most inner iframe to the outer page, where my google analytics is.

  • Hi Julian, thank you very much for all your excellent content!
    I'm looking for a solution to track clicks on Facebook customer chat and send it to GA with the help of GTM.
    My problem is that the Facebook customer chat is iframe and the GTM can't track gtm.click.
    Do you have any solution?

  • great video – thank you

  • I do have a question: by using an Iframe of a third party and sharing information from the iFrame to the Parent Frame, is this still compliant with regards to the new GDPR regulation? The scenario is now two different website's exchanging information, which is against the law if you have not informed your client about this right?

  • Hi Julian, I'm testing on my server, but on console send me an error: VM4907:1 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://test.domain.com') does not match the recipient window's origin ('https://test.domain.com'). – Just I replaced my original website with fake domain.com here! Steps are: 1st Container in iFrame, Sender with formSubmit and published. 2nd Listener with PV where parent iFrame is embeded, then GA event with cEvent. So, FormSubmit doesn't work?! Thank you

  • Thanks Julian, this is a great help. One question: we have a setup with one container for every language in GTM. Should we use different (language) containers for the iframe too?

  • Hi Julian, thank you for this tutorial! Is this also working with 2 domains, where www.parentdomain.com and iframedomain is 123.abc.parentdomain.com? Somehow the passing of message is not happening, eager to hear your thoughts. thanks!

  • Hi- I was curious why do we need extra effort in creating "sender" and "listener" – Just from a tracking perspective, if we have already placed GTM in the iframe – I suppose we are good enough to track events within the iframe and send data to GA. Why do we have to push this data to the parent frame?

  • Hi Julian, thanks for the tutorial! If you had an iframe with a register form (for new users) and a sign in form (for registered users), would you use a separate GTM account for either iframes or just put the same GTM code in all iframes? TIA

  • Hello Julian, thanks for sharing the videos in you channel, can you please demonstrate how to track an iframe video in GTM?

  • Hi Julian, this is the parent frame https://mariemarks.com/ and within this there is an iframe video https://iframe.mosaeek.com/womenempowerment . We have control over the domain https://iframe.mosaeek.com and have implemented GTM in the HTML but no luck in tracking the video (48+ hrs). Can you kindly do a tutorial on this scnario? Thank you!

  • So you say if i don't ve access to third party iframe details, its totally impossible to track it? Also would the same format you described above be helpful for SPA websites?

  • Great video, but this link is broken https://measureschool.com/iframe Please could you re-instate this so I can grab the code.

  • Thanks heaps for your video, man. I'm trying to set up Acuity Scheduling (a calendar scheduling platform), which is embeded on my website on the contact page.

    I do have access to add custom tracking code within the Acuity Scheduling admin panel. You can add Google Analytics, Facebook Pixel OR custom tracking.

    I've set up custom tracking with my Google Tag Manager code and also enabled cross-domain tracking. I added the two domains it might use. Could this work too?

    Essentially, I just want to track conversions and website behaviour of people who click from a Google Ad, view my website and then make a booking with the embedded scheduling platform.

    Can you please help me?

    You can view the page here:
    https://www.lukejbonner.com/bookings/

  • What is the html code that I would need to us???

  • I apologize if this is painfully obvious, but I just started learning this a day ago so I'm still getting the hang for how all of these aspects of GTM work together. I found a couple of things a bit confusing: 1. Why are you using custom HTML tags to input Javascript instead of custom Javascript in a user defined variable and a custom datalayer variable? 2. If I have an iframe that has it's own Javascript file, could I not just implement the datalayer object and postMessage directly in the iframe's Javascript file when a user clicks the button? That way you would only need to set up a listener and a tag in the parent frame? Thanks so much for all of your great videos, they have helped me immensely!

  • Hi! Could you please tell me how to use this method to send ecommerce data (standard ecommerce)? Do I have to add ecommerce variables somewhere in the Sender tag? And then just create Transaction tag in a parent GTM?

  • Hi Julian, could help me understand why we don't put the GA tracking code with the associated event in the iframe instead of the postMessage? My assumption is because it will skew view calculations but just wanted to confirm. Any help would be most appreciated.

  • Why i can not do this? :/ i set up sender and listener code, form submission is fired on the iframe website, but can not fire it on the parent website. Can you tell me what i am missing? Thanks.

  • Hi Julian,

    Just wanted to check if the code you used to push the values from child container to parent is platform specific!!
    To precise, will this code works for all the CMS platforms?

    Thanks in advance! 🙂

  • This is amazing. Thank you! Can you elaborate on why you don't like to fire the Google Analytics event directly from the iFrame GTM container?

  • Hi Julian, thanks for your tutorial! I love to try a test but it seems I can't find your custom HTML code for sender & listener postMessage. Can you show me where to download them? Thank you

  • Hi Is there a GA setting that needs to be enabled for tracking the original Source / Medium of the user that completed the iframe event?

  • Julian, I've downloaded the iframe.zip file and I'm not sure the contents were what I was expecting to see. Can you take a look at your download file and make sure that it is what you meant to post? Thanks!

  • Hi, i like a lot your videos, i learned a great deal, thank you so much.

    How i keep sources traffic in i-Frames, i tryed use this tutorial but not work.:https://www.bounteous.com/insights/2015/11/18/tracking-complex-interactions-in-iframes-google-analytics-iframes-pt-3/
    Are you make a video with explanation? Or help me in this comment.

  • Hey Julian,
    Great tutorial! Can this technique be used to send pageveiws and other data? I'm working with a software company that wants to share the data within there web app with the websites where it is embedded. We've created virtual "pageviews" for the webapp since the URLs don't change. Would creating a listener for that work to integrate it into the pageviews of the parent site? And would that then keep the medium/source data?

  • REMEMBER TO CHANGE THE URL IN POST MESSAGE…
    I spent wayyyyy to long troubleshooting to not share : )

  • Can this same process be done if both the iFrame and the page are using the same GTM?

  • Nice work.

  • Hi Julian – Thanks for this video. I've actually used this before to set up form submission tracking so I know it works. What I'm working on now is a little different and hoping you can help. My GTM environment has zones. GTM – A1 is the main container that's on all websites. GTM – A2 is specific to website B, which has the iFrame. This set up allows us to create tags that we need specifically for certain websites and also allows us to control access to our GTM environments as we have multiple parties, that need different levels of access, working on our websites at a given time. I created a separate container for the iFrame and it is deployed correctly.

    Question: Which container, GTM – A1 or GTM – A2, should get the listener tag?

  • how do i edit the event listener you created to match the specifics of my post message?

  • https://www.simoahava.com/analytics/tracking-cross-domain-iframes-upgraded-solution/

  • A listener is not working. Should we do something else?

Leave a Reply

Your email address will not be published. Required fields are marked *