DCR Italy Video Browser SDK (6.0.1)

From Engineering Client Portal

Revision as of 14:13, 28 September 2017 by NielsSedat (talk | contribs) (adding event 6 and 8)

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png International breadcrumbArrow.png DCR Italy Video Browser SDK (6.0.1)

This guide will show how to integrate the Nielsen Software Development Kit (SDK) to enable Digital Content Ratings (DCR) video measurement on browser players.

Prerequisites

To get started, an App ID is needed. The App ID is a unique ID assigned to the player/site/app. This will be provided upon starting the integration.

TXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Configure SDK

There are two steps required for configuring the SDK:

  • Add Static Queue Snippet
  • Create SDK Instance

Add Static Queue Snippet

Add the following script tag to the website:

<script>
!function(t,n)
{
  t[n]=t[n]||
  {
    nlsQ:function(e,o,c,r,s,i)
    {
     return s=t.document,
     r=s.createElement("script"),
     r.async=1,
     r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
     i=s.getElementsByTagName("script")[0],
     i.parentNode.insertBefore(r,i),
     t[n][o]=t[n][o]||{g:c||{},
     ggPM:function(e,c,r,s,i){(t[n][o].q=t[n][o].q||[]).push([e,c,r,s,i])}},t[n][o]
    }
  }
}
(window,"NOLBUNDLE");
</script>

The static queue snippet allows the SDK APIs to be called while the actual SDK and configuration file are still being downloaded. As the queue can capture all API calls before the download completes, there is no wait time. Once the SDK is available, the API calls will transition from directing to the queue to the SDK seamlessly.

Create SDK Instance

To initialize the SDK, create an SDK instance by making the initialization call:

Initialization API Call

NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{
       clientid: 'it-123456',
       vcid: 'c01',
       nol_sdkDebug: "debug"
})

When creating an instance, pass the following three values:

Parameter Description Values
apid Unique ID assigned to player/site 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
instanceName Name of SDK instance "any string value"
clientid Brand value has to be passed here Nielsen provided
vcid VCID value has to be passed here Nielsen provided
nol_sdkDebug Enables Nielsen console logging. Only required for testing "{nol_sdkDebug: "debug"})"


When the initialization call is made, a unique static configuration file, <apid>.js, will be downloaded based on the apid and will be cached on the user’s browser.

Once the configuration is downloaded, the SDK itself will be downloaded and initialized. All SDK modules are included in one file: “nlsSDK601.bundle.min.js”.

Example SDK Configuration

The configuration should include the Static Queue Snippet and an SDK Instance for an unique App ID as shown in the example:

<script type="text/javascript">
  // Add Static Queue Snippet
 !function(t,n)
 {
   t[n]=t[n]||{nlsQ:function(e,o,c,r,s,i)
   {
    return s=t.document,
    r=s.createElement("script"),
    r.async=1,
    r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
    i=s.getElementsByTagName("script")[0],
    i.parentNode.insertBefore(r,i),
    t[o]=t[o]||{g:c,ggPM:function(n,e,c,r,s){(t[o].q=t[o].q||[]).push([n,e,c,r,s])}},
    t[o]
   }
 }
} 
(window,"NOLBUNDLE");
 
  // Created SDK Instance
  var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX","nlsnInstance", {nol_sdkDebug: "debug"});
</script>

Create Metadata Objects

There are two types of asset metadata:

  • content: identify video
  • ad: identify each ad

The metadata received for each asset is used for classification and reporting.

Metadata can be passed through key-values using the Nielsen reserved keys. User will need to set up content and ad objects with the required Nielsen keys as shown in the sample code below.

Content Metadata

Content metadata should remain constant throughout the completion of an episode / clip including the ads play.

Key Description Values Required?
clientid Brand value is automatically populated through the App ID provided. The value passed here will override the default value. (e.g. Multiple brands in App) Nielsen provided
vcid VCID value is automatically populated through the App ID provided. This value passed here will override the default value. (e.g. Multiple Sub-brands in App) Nielsen provided
type

Type of measurement:

  • video – "content"
"content"
assetid Unique ID assigned to content custom
program Program name custom
title Episode title custom
length Length of content in seconds for VOD. The estimated content length has to be passed for live content. seconds (86400 for live stream)
mediaURL URL location of the content being streamed custom
airdate Original (local) air date and time (Eastern Time for US) YYYYMMDD HH24:MI:SS
isfullepisode Full episode flag

"y" - full episode

"n" - non-full episode

segB Segment B custom
segC Segment C custom
crossId1 Standard episode ID custom
crossId2 Content originator (required only for distributors) Nielsen provided
adloadtype

Type of ad load:

  1. Linear - matches TV ad load
  2. Dynamic - Dynamic Ad Insertion (DAI)
"1" - Linear

"2" - Dynamic

hasAds Whether the content is ad supported

"0" - No Ads

"1" - Ad Supported

"2" - Unknown (default)

Example Content Object

//create content object
var contentMetadataObject =
{  
  type:           'content',
  assetid:        'VID123-123456',
  program:        'program name',
  title:          'episode title',
  length:         'length in seconds',
  mediaURL:       'http://www.site.com/videoAsset',
  segB:           'custom segment B',
  segC:           'custom segment C',
  airdate:        'YYYYMMDD HH:MI:SS',
  isfullepisode:  'y',
  crossId1:       'Standard Episode ID',
  crossId2:       'Content Originator',
  adloadtype:     '2',
  hasAds:         '1'
};

Ad Object

The ad metadata should be passed for each individual ad.

Keys Description Values Required
type type of ad "preroll", "midroll" or "postroll"
assetid uniqueID assigned to ad custom

Example Ad Object

//create ad object
var adMetadataObject = 
{  
  assetid: 'AD-1',
  type:    'preroll'
};

URL Character Limit: There is a URL character limit of 2K characters due to browser limitations. Exceeding this value could impair data delivery on particular browsers.

Call Nielsen APIs

The method for calling events is ggPM().

nSdkInstance.ggPM('event', parameter, ...);

Events

The events are included in the table below:

Event Number Values to pass Description
'3' content/ad metadata object Load metadata event for content.
'5' playhead position Call when content or ads start playing.

VOD: The playhead position must be passed.

Live: Playhead in seconds from 1970

'6' playhead position Pause: Call when content or ads is pausing.

VOD: The playhead position must be passed.

Live: Playhead in seconds from 1970

'7' playhead position Call when content or ads complete playing. The playhead position must be passed when calling stop
'8' playhead position from, playhead position to Call when scrubbing forward or backward with playhead position from and to
'15' content/ad metadata object Call at the beginning of each asset, don’t use ‘play’ if event 15 is used
'49' playhead position VOD: current position in seconds.

Live: current unix timestamp Notehas to be called on a secondly basis

'57' playhead position This event has to be called for the current video asset at the end of the playback.

Example: at the end of the content stream, if the user switches to another piece of content, when the browser is refreshed or closed.

SDK Event Lifecycle

The sample event lifecycle can be used as a reference for identifying the order for calling events.

//Start of stream
nSdkInstance.ggPM('3', contentMetadataObject);
 
//Preroll
nSdkInstance.ggPM('15', prerollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // Event 49 should be fired every second with playhead starting from 0
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
//Content
nSdkInstance.ggPM('5',  contentPlayheadPosition);
nSdkInstance.ggPM('49', contentPlayheadPosition); // Event 49 should be fired every second with playhead starting from 0 if this is the first segment
nSdkInstance.ggPM('6',  contentPlayheadPosition);
 
//Midroll
nSdkInstance.ggPM('15', midrollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // Event 49 should be fired every second with playhead starting from 0
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
//Content
nSdkInstance.ggPM('5',  contentPlayheadPosition);
nSdkInstance.ggPM('49', contentPlayheadPosition); // Event 49 should be fired every second with playhead starting from where it left off before mid-roll
nSdkInstance.ggPM('6',  contentPlayheadPosition);
nSdkInstance.ggPM('57', contentPlayheadPosition);
 
//Postroll
nSdkInstance.ggPM('15', postrollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // Event 49 should be fired every second with playhead starting from 0
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
//End of Stream
nSdkInstance.ggPM('7',  contentPlayheadPosition);

Note: Event '49' is used for calculating duration and must be passed every second. The final playhead position must be sent for the current asset being played before calling event '7', '57', or '15'.

Note: For Ad Pods, events must be called for each individual Ad. Each Ad playhead position should begin at ‘0’ when ad starts.

Note: When content has resumed following an ad break, the playhead position update must continue where previous content segment left off. The playhead position should be passed as a rounded number with no decimals.

Handling Pause The event 49 is used for handling pause. To indicate pause, stop passing the playhead position to the SDK. Once the content resumes, begin sending the playhead again with the correct playhead value.

Interruption Scenarios The following possible browser interruption scenarios must be handled:

  • Browser/Tab close
  • Leaving the page to another destination
  • Pressing the stop button

There are many cases where the player itself has the ability to detect such situations. If not, these interruption scenarios can be handled through JavaScript. The events that are called will depend on the asset being played (e.g. midroll vs. content).

window.addEventListener('beforeunload', function(event) 
{
  // Only inside a midroll indicate  for the ad
  nSdkInstance.ggPM('7', playheadPosition);
  
  // Indicate  and  for the content
  nSdkInstance.ggPM('57', playheadPosition);
  nSdkInstance.ggPM('7', playheadPosition);
});

Note: User may need to add code to support specific browser versions (e.g. older versions of Internet Explorer).

Opt-Out

The site must provide a means for the user to opt-out of, or opt back into, Nielsen Measurement. A user can opt-out if they would prefer not to participate in any Nielsen online measurement research. To implement the opt-out option, include the following two items in your privacy policy.

  • A notice that the player includes proprietary measurement software that allows users to contribute to market research (such as Nielsen TV Ratings).
  • A link to the Nielsen Digital Measurement Privacy Policy at http://www.nielsen.com/digitalprivacy.

On the Nielsen Digital Measurement Privacy Policy page, users can click Choices to read more detailed information about the measurement software, learn about their options with regard to Nielsen measurement, and, if they do not want to participate in Nielsen online measurement, click a link to receive an opt-out cookie.

The following paragraph is a template for an opt-out statement.

The properties may feature Nielsen proprietary measurement software, which will allow users to contribute to market research, such as Nielsen TV Ratings. To learn more about the information that Nielsen software may collect and your choices with regard to it, please see the Nielsen Digital Measurement Privacy Policy at http://www.nielsen.com/digitalprivacy.

Opt Back In

Once users have opted-out, they can choose to opt back into Nielsen Measurement at anytime by selecting the opt back in link on the Nielsen Digital Privacy Policy page. When a user selects the link, their opt-out cookie will be deleted and they will be able to be measured.

Going Live

Once the DCR Tracking Code is added to Instant Articles, Nielsen will validate the implementation. Following Nielsen testing, users need to make a couple of updates to the initialization call to ensure that the site is being measured properly.

  1. App ID: Ensure that correct <apid> is used during initialization
    'PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    
  2. Debug Logging: Disable logging by deleting {nol_sdkDebug: 'DEBUG'} from initialization call.
    • Example Production Initialization Call - Refer to the production initialization call below:
      var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance");