• enablejsapi=”true”

    Is there a way to pass this parameter in the shortcode? Or where could I edit the plugin code to insert this for every embed?

    This code is needed for Google Analytics’ GA4 to automatically track YouTube videos (as event).

    Thanks.
    —————
    Some relevant information:

    `Video tracking in enhanced measurement works for embedded Youtube videos that have the JavaScript API enabled. That can be done by adding the enablejsapi=”true” attribute to the iframe, for example:

    <iframe src=”https://www.youtube.com/embed/QfUSKYJz5QE&#8221; width=”560″ height=”315″ title=”YouTube video player” enablejsapi=”true” frameborder=”0″ allow=”accelerometer; clipboard-write; encrypted-media; picture-in-picture” allowfullscreen></iframe>
    Or by decorating iframe’s src with “enablejsapi=1”, for example:

    OR

    <iframe width=”560″ height=”315″ src=”https://www.youtube.com/embed/QfUSKYJz5QE?enablejsapi=1&#8243; title=”YouTube video player” frameborder=”0″ allow=”accelerometer; clipboard-write; encrypted-media; picture-in-picture” allowfullscreen></iframe>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor David Artiss

    (@dartiss)

    Hey.

    No, there isn’t an easy way to enable it. I used to have it on by default but removed it because I was trying to keep the URL as short as possible and I wasn’t sure of its use.

    I’ll look at some point to add this on as a switchable option.

    Thread Starter Harriman

    (@harriman)

    Thanks for responding and considering!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘GA4 video tracking IE enablejsapi=”true” parameter’ is closed to new replies.