Google Analytics
Table of contents
Totals
How much video is watched? How many minutes?
Bars
What are the most popular videos? How much in foreign sites? What about the home page?
Pies
Which continent? Which video format? Which browser?
How does it work?
Flowplayer tracks the following information when a visitor leaves a page:
- Seconds played. If the video was repeated /looped this will be more than the duration of the video
- Flash or HTML5 engine type
- Video title or file name
These views can be found under
Google Analytics > Content > Events > Top Events > Video / Seconds played.
Play around with the 'Secondary dimension' dropdown. For a better visual view select the pie chart. If your site already uses or is planning to use Google Analytics it's good to view those statistics in the same place.
Setting up
Set up Analytics by configuring your Google Analytics ID. For example:
<div class="flowplayer" data-analytics="UA-27182341-1" title="Video title">
<video>
<source type="video/webm" src="/my/video.webm">
<source type="video/mp4" src="/my/video.mp4">
</video>
</div>
This site uses a global configuration to set up analytics for all players on the page:
flowplayer.conf.analytics = "UA-27182341-1";
The title for Analytics is taken from the clip's title or, if not set, the video's file name.
If the player is shared on a foreign site the analytics ID is carried along so you can view how much video is played on these external domains.
Configuration
The Analytics extension provides one player option:
-
- option
- description
- example
-
- analytics string
- The site's Google Analytics ID.
analytics: "UA-27182341-1"
What is tracked?
The best place to track video data is when user leaves the page. You know exactly the total amount of seconds viewed. Sending data during playback gives you messy results; pausing, fullscreen, seeking are not important.
Flowplayer tracks the following events:
load
player eventunload
player eventunload
window event
Addtionally a heartbeat is sent at an interval of 10 minutes to prevent tracking timeouts.
Enhancing the functionality
If you wish to implement a more fine-grained player event tracking you can use the various player events to communicate with the Google Analytics API.
The source code of the Google Analytics extension might be a good starting point.