Initialize / Configure 3rd-party Player on Desktop - JavaScript

The following libraries and configuration data are required; obtain these from your Adobe representative:
  • Required Adobe Video Tracking Libraries:
    • AppMeasurement.js - Contains the non-media specific tracking core logic.
    • AppMeasurement_Module_media.min.js - Contains the media-specific tracking core logic. It also includes the real-time video data collection core logic.
    • heartbeat.min.js - Contains a series of helper classes that greatly reduce the integration effort, as well as the amount of code needed to implement video tracking in the player.
    • VisitorAPI.js - Uniquely labels the user of the web page hosting the video player. (This is required only for Desktop apps (ActionScript and JavaScript.)
  • Required Configuration / Initialization Data:
    • AppMeasurement Tracking Server Endpoint - The URL of the endpoint where all of the AppMeasurement tracking calls are sent
    • video heartbeat Tracking Server Endpoint - The URL of the endpoint where all of the video heartbeat tracking calls are sent
    • Visitor Tracking Server Endpoint - The URL of the endpoint that provides the unique "label" for the current user
    • Visitor namespace - A string value required for instantiating the Visitor component
    • Job ID - This is the processing job identifier. It is an indicator for the back-end endpoint about what kind of processing should be applied for the video tracking calls
    • Publisher Name - This is the name of the content publisher
    • Account Name - Also known as the Report Suite ID (RSID)
The following procedure describes the steps required to implement real-time video tracking in your player using the video heartbeat library. The required components must be instantiated and configured at the application level, in the order given here:
  1. Instantiate and configure the VisitorAPI library
  2. Create an instance of the AppMeasurement library. This instance must aggregate the VisitorAPI instance. Also, the AppMeasurement instance must explicitly load the module that deals with media-specific tracking. There is a specific public method exposed for this particular purpose (see code samples below).
  3. Create the video heartbeat library which in turn aggregates the AppMeasurement instance created during the previous step.
In summary, the application developer is in charge of instantiating all of the video-tracking components while managing this dependency chain: VisitorAPI -> AppMeasurement/AppMeasurement_Module_Media -> video heartbeat.
The ABD global module - In order to keep the JavaScript global namespace as clean as possible, the video heartbeat library defines a specific global-level module that acts as a namespace. This module is called ADB. All symbols exposed by this library through its public API are made available as properties attached to the ADB module. The set of exposed symbols is further segmented into sub-namespaces. Of particular interest to the application developer is the heartbeat sub-namespace, which publishes all symbols related to video-tracking APIs. Obtaining a reference to the VideoHeartbeat() constructor function can be done as follows:
var VideoHeartbeat = ADB.heartbeat.VideoHeartbeat
  1. Instantiate and configure the VisitorAPI component:
    // Instantiation
    var visitor = new Visitor("Visitor namespace");
     
    // Configuration
    visitor.trackingServer = "Visitor tracking endpoint";

    Instantiating the Visitor API component requires an input namespace parameter. This is a pure string value.

    There is only one configuration option available for the VisitorAPI component -- the URL of the back-end endpoint that provides the unique "label" for the current user.

  2. Instantiate and configure the AppMeasurement component:
    // Instantiation
    var appMeasurementObject = new AppMeasurement();
    appMeasurementObject.account = "Account name";
     
    // Use the same value here that you provided in Step 1 for Visitor API.
    appMeasurementObject.visitorNamespace = "Visitor namespace";
    
    // This is the Adobe Analytics (SiteCatalyst) endpoint
    appMeasurementObject.trackingServer = "Adobe Analytics tracking server endpoint";
     
    // Attach the VisitorAPI to the AppMeasurement instance.
    appMeasurementObject.visitor = visitor;
     
    // Explicitly load the "Media" module
    appMeasurementObject.loadModule("Media");
    There are many configuration options available on the AppMeasurement instance that are not shown here. (See the Adobe Analytics Developer page for more configuration options.) The three options shown in the sample code above are required (account, visitorNamespace, trackingServer).
    It is important to properly set up the dependency chain:
    • The AppMeasurement instance aggregates (depends on) the Visitor API component.
    • The application developer must explicitly load the media module by calling the loadModule("Media") method. The code for the media module is inside the AppMeasurement_Module_Media.min.js file.
  3. Instantiate and configure the video heartbeat component. Instantiating video heartbeat is a two-step process, due to its dependency on these two components:
    • The AppMeasurement component
    • An implementation of the PlayerDelegateProtocol interface.

    It is the responsibility of the video player developer to implement and instantiate the PlayerDelegateProtocol interface. Once this implementation is in place, the instantiation process is very straightforward:

    Instantiate the video heartbeat component:
    var VideoHeartbeat = ADB.heartbeat.VideoHeartbeat;
     
    // The CustomPlayerDelegate class implements the PlayerDelegateProtocol interface.
    var playerDelegate = new CustomPlayerDelegate();
     
    // We now have all ingredients to instantiate the video heartbeat library.
    var videoHeartbeat = new VideoHeartbeat(appMeasurementObject, playerDelegate);
    Configure the newly created video heartbeat instance:
    var ConfigData = ADB.heartbeat.ConfigData;
     
    // Instantiate the configuration object
    var heartbeatConfig = new ConfigData();
     
    heartbeatConfig.playerName = "the name of your player app";
    heartbeatConfig.trackingServer = "video heartbeat tracking server URL";
    heartbeatConfig.jobId = "Your JOB-ID";
    heartbeatConfig.publisher = "Publisher name";
    heartbeatConfig.ovp = "The name of the online video platform (like youtube etc)";
    heartbeatConfig.sdk = "The version of your video player";
     
    // Set this to true to activate the debug tracing
    heartbeatConfig.debugLogging = false;
     
    // Explicitly activate the video heartbeat functionality.
    heartbeatConfig.enableHeartbeat = true;
     
    videoHeartbeat.config(heartbeatConfig);
    Important: In the code listing above, notice the explicit activation of the heartbeat tracking functionality. The application developer needs to set the enableHeartbeat flag to true inside the configuration object. If this step is omitted, no heartbeat calls will be sent over the network.
    Note: Setting the debugLogging flag to true activates extensive tracing messaging, which may impact performance. While tracing is useful during development and debugging efforts, the application developer must set this to false for the production version of the player app. The logging mechanism is disabled by default.