Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using Google Analytics Event tracking and the Vidyard player API, we can push player events into Google Analytics to allow us to capture some useful viewership data along side the standard web traffic reporting.
<!-- Vidyard player API script -->
<script src="//"></script>
<!-- Google Analytics tracking code -->
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('send', 'pageview');
<!-- Vidyard video embed code -->
<script type="text/javascript" id="vidyard_embed_code_CvMSiespEMc5lia2k2fHeg" src="//"></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']); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.