Setup google analytics
Be sure to also check our Analytics plugin. It's an alternative to the scripted approach we demonstrate in this page.
Analytics has a wonderful feature called Event Tracking which is just perfect for Video applications. You can track when your visitors hit play, pause or stop and gather information about the video and at what second each action occurred. Here is a screenshot about statistics that was generated from this page over a one day period:
Now that you have the analytics variable ready, you can use it in your event listeners as follows:
If you have Firebug installed you can see from the Net panel that Google requests are indeed being made. Having Firebug available greatly helps when developing this kind of scripts.
Accessing the Analytics information
You should find the Event information on the Google Analytics interface under Content -> Events. However, event tracking is still in beta and you may not see this link on your interface. Luckily there is a workaround for this. Go to Content -> Overview and you will end up with this kind of URL:
Now change that URL so that you replace
events as follows:
And BANG you can see events. You can see an overview of all your events.
There are lots of things you can do there. For example, you can study each
action separately. Here we have an overview of all
pause events that
happened during a one day period on this page.
You can see that on average
pause has been pressed at 2.670 seconds. Maybe
there was something interesting there? Of course you can track any event you
want such as entering fullscreen, seeking, resuming from pause etc. You may
want to put scripting inside your event calls and only track when certain
conditions are met. It's up to you to determine how you want to organize your