YouTube with Analytics events

1

I'm using the following scheme to embed the Youtube videos: link

This allows the video to be requested only when the user clicks on the player (thumbnail), causing the page to load faster.

I need to add a Google Analytics event tracking to when the user clicks the "play / thumbnail" that renders the video iframe.

ga('send', 'event', 'Videos', 'play', 'Video1');

Is there a way to implement this to this jsfiddle code?

    
asked by anonymous 12.03.2016 / 10:03

1 answer

0

SOLUTION:

document.querySelector(".youtube-player").addEventListener("click",function(){
ga('send', 'event', 'Videos', 'Play', 'Video1');
});
    
14.03.2016 / 01:07