Skip to content

Instantly share code, notes, and snippets.

@joshorvis
Forked from jramsahai/push_to_ga.html
Last active August 29, 2015 14:11
Show Gist options
  • Save joshorvis/ad81e2c960f7d5e591a4 to your computer and use it in GitHub Desktop.
Save joshorvis/ad81e2c960f7d5e591a4 to your computer and use it in GitHub Desktop.
<html>
<head>
<!-- Vidyard player API script -->
<script src="//play.vidyard.com/v0/api.js"></script>
<!-- Google Analytics tracking code -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<!-- Vidyard video embed code -->
<script type="text/javascript" id="vidyard_embed_code_CvMSiespEMc5lia2k2fHeg" src="//play.vidyard.com/CvMSiespEMc5lia2k2fHeg.js?v=3.1&type=inline"></script>
<!-- Player API tracking into Google Analytics -->
<script type="text/javascript">
var video = new Vidyard.player("CvMSiespEMc5lia2k2fHeg");
video.on("ready", function() { _gaq.push(['_trackEvent', 'Videos', 'Ready', 'Homepage Video']); });
video.on("play", function() { _gaq.push(['_trackEvent', 'Videos', 'Play', 'Homepage Video']); });
video.on("pause", function() { _gaq.push(['_trackEvent', 'Videos', 'Pause', 'Homepage Video']); });
video.on("playerComplete", function() { _gaq.push(['_trackEvent', 'Videos', 'End', 'Homepage Video']); });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment