Need help with videojs-ga?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

mickey
135 Stars 113 Forks MIT License 33 Commits 24 Opened issues

Description

Google Analytics plugin for video.js

Services available

!
?

Need anything else?

Contributors list

No Data

videojs-ga

LOOKING FOR A MAINTAINER: I am looking for a maintainer for this project

Google Analytics plugin for video.js

Getting Started

Download videojs and videojs.ga

In your web page:

html




Please note that the Google Analytics script must be loaded before the ga plugin

Options

You can provide options to the plugin either by passing them in the javascript or in the html.

player.ga({
  'eventsToTrack': ['fullscreen', 'resize'],
  'debug': true
});

The plugin will take in priority options provided in the javascript, followed by the ones provided in html and finally the defaults.

The following options are supported:

eventCategory

This is the

category
sent to GA. If you don't know what it is please check GA's doc default:
'Video'

eventLabel

This is the

label
sent to GA. If you don't know what it is please check GA's doc default: basename of the video path so if the path is
http://s3.amazonaws.com/pouet.mp4
the label would be
pouet

eventsToTrack

The events you want to track. Most of this events are videojs events. Some of them might reflects my needs. I'm open to add some more if you care to provide a good use case or a pull request. default: every events

[ 'loaded', 'percentsPlayed', 'start', 'end', 'seek', 'play', 'pause', 'resize', 'volumeChange', 'error', 'fullscreen']

Most of the events are selft explanatory, here's the ones that may need more details:

  • percentsPlayed
    : will send an event every X percents. X being defined by the option
    percentsPlayedInterval
    .

percentsPlayedInterval

This options goes with the

percentsPlayed
event. Every
percentsPlayedInterval
percents an event will be sent to GA. default: 10

debug

If set to false, console logs will be ommited default:

false

ga.js and analytics.js

This plugin supports the ga.js and the newer analytics.js Google Analytics libraries. It autodetects the library you use.

See information in google

To view the data on Google, access your account in analytics, in left panel click in Behavior > Events > Top Events.

TODO

  • [x] track the engine used (html5/flash) along with the source (ogg, mp4, ...)
  • [ ] track the time to download the video

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.