Analytics
2.5K members online now
2.5K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Tracking iframe embedded YouTube videos on page

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi

 

I would like to track plays of a video we have on a landing page and was wondering what the best way to do this is?

 

Other than adding the code for Event tracking (in addition to Google Analytics code) is there anything else that needs to be added?

 

For the Event tracking code, I was going to install this:

 

var pauseFlag = false;
function onPlayerReady(event) {
   // do nothing, no tracking needed
}
function onPlayerStateChange(event) {
    // track when user clicks to Play
    if (event.data == YT.PlayerState.PLAYING) {
        _gaq.push(['_trackEvent', 'Videos', 'Play', 'Test Video']);
        pauseFlag = true;
    }
    // track when user clicks to Pause
    if (event.data == YT.PlayerState.PAUSED && pauseFlag) {
        _gaq.push(['_trackEvent', 'Videos', 'Pause', 'Test Video']);
        pauseFlag = false;
    }
    // track when video ends
    if (event.data == YT.PlayerState.ENDED) {
        _gaq.push(['_trackEvent', 'Videos', 'Finished', 'Test Video']);
    }
}

 

I have copied and pasted this code off a blog post I was reading. Just wanted to confirm that I have everything correct :-)

 

Thanks in advance

 

Anna

Re: Tracking iframe embedded YouTube videos on page

Explorer ✭ ☆ ☆
# 2
Explorer ✭ ☆ ☆
Hi Anna,
you can look at the lunametrics Youtube Tracking for Google Analytics

Here you find more detail
http://www.lunametrics.com/blog/2015/05/11/updated-youtube-tracking-google-analytics-gtm/

Fil

Re: Tracking iframe embedded YouTube videos on page

Follower ✭ ✭ ✭
# 3
Follower ✭ ✭ ✭
Hi Anna,

If you are using Google Tag Manager I recommend following the instructions on this blog post for Youtube Video tracking http://www.cardinalpath.com/youtube-video-tracking-with-google-tag-manager-v2-and-universal-analytic... it is a much faster set-up and you don't have to keep on updating the code on your site.

Re: Tracking iframe embedded YouTube videos on page

Explorer ✭ ✭ ☆
# 4
Explorer ✭ ✭ ☆
You know, you could look at YouTube Analytics and find out the source of the video views. That is as long as you are the owner of the video. https://www.youtube.com/analytics?o=U#dt=nt,r=trafficsources,

Re: Tracking iframe embedded YouTube videos on page

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Thanks for your reply Fil. I think I came across this during my research.

Anna

Re: Tracking iframe embedded YouTube videos on page

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
Thanks for your reply Sikoursky. Yes, I think installing Tag Manager will make things easier!

Anna

Re: Tracking iframe embedded YouTube videos on page

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Hi Miguel, thanks for your reply.

Thing with You Tube Analytics, are you able to separate traffic from different sources ie want to isolate people who view it on the landing page rather than from our actual YouTube channel.

Thanks

Anna

Tracking iframe embedded YouTube videos on page

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

hey all, does anyone know, once you follow the tag manager instructions and what not -- where in google analytics do you see the information on the embedded iframe videos? Is it under Behavior > Events? Or elsewhere?