Video Analytics API

Add the JavaScript tracking snippet to your page before your closing tag.

<!-- DVIDS Video Analytics -->
<script async src='https://cdn.dvidshub.net/js/DVIDSVideoAnalytics.min.js'></script>
<!-- End DVIDS Video Analytics -->

Events

Track events with:

DVIDSVideoAnalytics.track(name, properties);

Event names:

  • loaded: When video is initially loaded upon page load.
  • play: Specific document id to retrieve for search. Example: "image:123456". Required.
  • ended: Video has ended

Event properties:

  • domain (required): The domain of the site the video is loaded on (ex. wwww.dvidshub.net)
  • original_referrer: If you would like to provide the original referrer for the video landing page, provide it here.
  • type_id (required): The ID of the video being played from DVIDS.
  • unit: The unit ID the video belongs to.

Example for videojs on play event:

var analyticsParams = {
    domain: 'www.dvidshub.net',
    type_id: <?= $video->id ?>,
    original_referrer: '<?= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; ?>',
    unit: <?= $video->unit_id ?>
}

DVIDSVideoAnalytics.track('play', analyticsParams);