Skip to content

Commit

Permalink
Merge pull request mickey#24 from breim/master
Browse files Browse the repository at this point in the history
Adding example how track multiple videos on same page and improve documentation.
  • Loading branch information
mickey committed Dec 13, 2015
2 parents 9ee5803 + c19f46d commit 7b07d84
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ If set to false, console logs will be ommited

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

Expand Down
40 changes: 40 additions & 0 deletions demo/multiple-videos.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<html>
<head>
<meta charset="utf-8" />
<title>videojs-ga DEMO Multiple videos on same page</title>
<link href="../libs/video-js-4.6.1/video-js.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="../libs/video-js-4.6.1/video.dev.js"></script>
<script src="../dist/videojs.ga.js"></script>
</head>

<body>
<video id="video" controls preload="none" class="video-js vjs-default-skin" width="640" height="480">
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
</video>

<video id="video" controls preload="none" class="video-js vjs-default-skin" width="640" height="480">
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
</video>

<script>

$('video').each(function() {
videojs(this.id, {}, function() {
this.ga();
});
})

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXX-Y', { 'cookieDomain': 'none' });
ga('send', 'pageview');
</script>

</body>
</html>

0 comments on commit 7b07d84

Please sign in to comment.