Learn business growth with Google Analytics 4 Forums Google Analytics 4 Tracking Conversions in GA4: Updating Div from iframe, Feasible?

  • Tracking Conversions in GA4: Updating Div from iframe, Feasible?

    Posted by Henry on 18 September 2022 at 11:57 pm

    So, we’re working with an iframe on an antiquated CMS and we’re trying to make form-fill conversions work with GA4. Can we make it so that when the iframe div changes, a conversion event occurs? Like, when a form is filled out and submitted, the parent div then shows a message that reads “Thanks for submitting your contact us submission”. Could we potentially set this change as a marker for a conversion?

    Wyatt replied 1 year ago 3 Members · 2 Replies
  • 2 Replies
  • Theo

    Member
    24 June 2023 at 2:12 am

    Absolutely, you can set up a conversion for such a scenario. Here’s the deal: when you’re dealing with an iframe, it’s a bit tricky because we don’t have direct access to elements inside it from the outside, right? But don’t worry, we have a solution.

    One option is to have your iframe convey the message to the parent when an update occurs. It’s like a little courier between the iframe and your main page. When the form status changes, it notifies the parent of the update.

    Alternatively, you could bring in the big guns and use Google Tag Manager (GTM) directly within the iframe. This way, you’re handling the messaging yourself and you have full control over it.

    So yes, it can be done. Customize that conversion marker and make your GA4 data work for you.

  • Wyatt

    Member
    1 July 2023 at 11:01 pm

    Yes, technically it’s possible to register a conversion when the iframe div changes, as mentioned, but it might be more complex due to the nature of iframes. This is because the iframe content tends to be treated as a separate document and does not interact seamlessly with its parent page. This might demand some advanced JavaScript coding where a listener is implemented to watch for changes in the iframe. When the listener detects a change (like the appearance of the “Thanks for submitting your contact us submission” message), it triggers a GA4 event, which can be marked as a conversion. It’s important to note that this can require specific technical skills and a deep understanding of both the document structure and the Google Analytics 4 platform. Always seek expert advice if you are uncertain so as to ensure accurate data collection and reporting.

Log in to reply.