Skip to content

Instantly share code, notes, and snippets.

@fedecarg
Last active May 23, 2018 15:32
Show Gist options
  • Select an option

  • Save fedecarg/11b755423f3816b308bfc5f4d2d92afa to your computer and use it in GitHub Desktop.

Select an option

Save fedecarg/11b755423f3816b308bfc5f4d2d92afa to your computer and use it in GitHub Desktop.

Measuring Video in Adobe Analytics

1. Download the Video Heartbeat Library SDK

https://github.com/Adobe-Marketing-Cloud/video-heartbeat-v2/releases/tag/js-v2.0.2

2. Configure Heartbeat

Paste the following code inside the Video Heartbeat Library SDK, before the copyright notice:

_satellite.pushBlockingScript(function(event, target, $variables){
  window["adobeConfiguration"] = {
    scTrackingServer: 'discoverydp.sc.omtrdc.net',
    hbTrackingServer: 'discoverydp.hb.omtrdc.net',
    marketingCloudOrgId: '9AE0F0145936E3790A495CAA@AdobeOrg',
    reportSuiteId: _satellite.getDataElement("Report Suite ID")
}
});

/*
 * video heartbeats - 2.0.2 - 2017-04-21
 * Copyright (c) 2017 Adobe Systems, Inc. All Rights Reserved.
 */

3. Import file into DTM

This file will be hosted by Adobe DTM and requested from the domain assets.adobedtm.com.

4. Add tracking code snippet.

Paste the following snippet right after the <head> tag on each page of your site.

<script type="text/javascript" src="//assets.adobedtm.com/55c42c987178cce094489fba79ae9fa5af72b984/satelliteLib-854433498f39e1db96e8b1c14a4ecd0a5fa3df36.js"></script>

5. Create an instance of AdobeHeartbeat and set media delegate:

const adobeConfiguration = window.adobeConfiguration || {};

const heartbeat = new AdobeHeartbeat(adobeConfiguration);
heartbeat.setMediaDelegate(mediaDelegate);

6. Create instance of Brightcove player and add event listeners:

const player = videojs('#player').ready(() => {
    heartbeat.trackSessionStart();

    player.on('play', () => {
        heartbeat.trackPlay();
    });    
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment