Upcoming LunaMetrics Seminars
Boston, Apr 6-10 Los Angeles, Apr 13-16 Atlanta, Apr 27-30 Washington DC, May 11-15

Video Tracking in Google Analytics: Introduction

Interested in easily tracking YouTube Videos? We have some updated code. Check out our post here about Easily Tracking YouTube Videos in Google Analytics

Many sites have embedded video these days. I commonly hear requests from users of Google Analytics along these lines: “How can I measure whether my visitors are actually playing these videos? We spend a lot of money and effort producing them, so how do I tell if people even watch them? Or if they are more likely to become a customer if they do?”

Our approach: Event Tracking

We’re going to use the Event Tracking feature of Google Analytics to capture this stuff. If you’re not familiar, Event Tracking, in a nutshell, is designed to capture all of the non-pageview stuff that we might be interested in on a site. By default, Google Analytics captures just when pages load (through the regular tracking code on every page), but it doesn’t capture things that happen within pages, like clicks on downloads, or AJAX elements that bring in new content without a reload, or — in this case — plays of videos embedded in the page. Basically, anywhere someone clicks or otherwise interacts with the site, we can track.

Events get tabulated separately from the pages in a separate reporting section under Content. There are several parameters we can supply to describe an event:

  • Category (required): high-level groupings of the different kinds of events on our site
  • Action (required): within the category, what did the visitor actually do
  • Label (optional): further differentiate what happened
  • Value (optional): a numerical value that pertains to the event (no pre-assigned meaning, could be dollars or seconds or points or whatever)

Now, in the case of video, here is one example of how you might label the actions a visitor takes:

  • Category: Video
  • Action: Play, Pause, Stop, Finished
  • Label: The title or filename of the video (assuming you have more than one video on your site)

Now, it doesn’t always make sense to capture every single thing someone might do. We have to think about what actions are interesting to us to actually have data about so we don’t collect a bunch of useless information. For video, I tend to think the two most vital things are Play (did they start watching) and Finished (did they get all the way to the end). I don’t care so much whether they paused it in the middle to take a phone call, and I certainly don’t care if they adjusted the volume.

Once I have this data, I can see it all in the Event Tracking reports (and through Advanced Segments) and break it down however I like: how many visits played any video, which visits played (or finished) a particular video, whether they converted, and so on.

Types of video players

OK, so how do we actually start collecting this data? Well, it requires some additional tracking code on our site to measure the video player. Depending on where the video is hosted and how it is played on the site, there are a few different approaches. In a series of followup posts, I’m going to explore a few different scenarios and how to track them with Event Tracking:

  • Videos embedded with a Flash-based player, with special emphasis on FlowPlayer (an open-source player with a built-in capability for GA Event Tracking)
  • YouTube videos embedded in a page
  • Videos included in a page using the new HTML5 <video> element

Check back soon as we explore all the technical nitty-gritty to make the magic happen.

Jonathan Weber

About Jonathan Weber

Jonathan Weber is the Data Evangelist at LunaMetrics. He spreads the principles of analytics through our training seminars all over the East coast. The next seminar he'll be leading will be a Google Analytics training in Boston. Before he caught the analytics bug, he worked in information architecture. He holds a Master’s degree from the University of Pittsburgh School of Information Sciences. Jonathan’s breadth of knowledge – from statistics to analysis to library science – is somewhat overwhelming.


10 Responses to “Video Tracking in Google Analytics: Introduction”

Diego says:

Hi Jonathan! Great explanation, have you published this follow up?

Diego says:

by the way, thanks!

Jason says:

Any ideas how us non coder types could just see the code to track a video played or finished? I’m having no luck understanding the actual code I need to paste and where to paste it.

Tim says:

I agree…thanks. I’m at a loss to track audio and video plays. I have a need to look back a few months but without code on the site, I think I’m out of luck?. Will look for a followup.

Ravi says:

Hello Jonathan,

Do you have a working demo, I would like to see the code in action. I’ve been looking for a while for a script that can track embedded YouTube videos.


Richard says:

Hiya – interesting article, we’re using the SWF plugins but would like a non-Flash version.. Looking forward to the update ;)

Sally says:

Hi….Thanks for the article!! Am desperately trying to find out how to track video – specifically Play and Finished. I have read the Google Analytics Event tracking info, tried a whole lot of different things on my site and can’t get it to work. Would love the follow up articles – did you get a chance to do them? Thanks so much

Sayf Sharif Sayf Sharif says:

For some updated script on how to easily track embedded YouTube videos check out this post: http://www.lunametrics.com/blog/2012/10/22/automatically-track-youtube-videos-events-google-analytics/

Tomi says:

Hi. Did you ever manage to put together the guides for different video tracking options?

Mike says:

Hi. Does this work on Vimeo? If yes what do you put in the different fields? Thanks! Great Post!