Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #1303486

    Google Analytics GA4 has the ability to track youtube video interactions.
    This is possible if the Youtube video is embedded directly into the page.


    However, when the video is open in the Magnific modal Pop-up the video is embedded into an iFrame. class=”mfp-iframe”

    An iFrame as separate web entity to the parent website. Therefore a standard implementation of google analytics or via Google Tag Manager GTM, will not track the youtube events from within the iFrame.

    A custom event listener is required to pass events from the VIDEO iframe analytics account to the Parent analytics account.

    – – – – – – – – – – – – – – – – – – – – –
    After reviewing multiple suggestions. I think it would be easier if the iframe body in the modal window also included the same parent website google analytics tracking.

    I have implemented GOOGLE TAG MANGER using a hook.

    Other than editing the Enfold Theme Source code to directly and add the GTM implementation to the iframe output.

    I’d like to know if there is a hook specifically for the video Iframe so I can do this from the child theme.

    If there is no hook currently available. Which file do I need to copy from the parent theme to the child theme and how to I register this copy version to the Child theme.

    I look forward to your feedback


    Hey HuxburyQuinn,

    Thank you for the inquiry.

    Does it work properly when you instead open an inline content or an external URL containing the video? You can open a site page or URL in the lightbox by prepending the iframe=true parameter to it.

    Opening an inline popup:

    Unfortunately, as you said yourself, the iframe is a different web entity that is completely separate to the parent site, so injecting the same GA tag to the iframe may not be possible without significant code modification.

    Best regards,

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.