Difference between revisions of "DCR Italy Video Browser SDK (6.0.1)"

From Engineering Client Portal

(Content Metadata)
(Content Metadata)
Line 127: Line 127:
 
| length || Length of content in seconds for VOD. The estimated content length has to be passed for live content. || <code>seconds</code> (86400 for live stream) || ✓
 
| length || Length of content in seconds for VOD. The estimated content length has to be passed for live content. || <code>seconds</code> (86400 for live stream) || ✓
 
|-
 
|-
| airdate || Original (local) air date and time (Eastern Time for US); if not known set it to eg. "19700101 00:00:00" || <code>YYYYMMDD HH24:MI:SS</code> || ✓
+
| airdate || Original (local) air date and time (hh:mm:ss as 24h time stamp); if not known set it to eg. "19700101 00:00:00" || <code>YYYYMMDD hh:mm:ss</code> || ✓
 
|-
 
|-
 
| isfullepisode || Full episode flag ||
 
| isfullepisode || Full episode flag ||
Line 180: Line 180:
  
  
**Note**: for Audiweb clients there is no need to use 'mediaURL', 'segB', 'segC', 'crossId1', 'crossId2' and 'hasAds'. These parameters can be left out completely from structure. They are optional and not mandatory (and out of current reporting too).
+
'''Note''': for Audiweb clients there is no need to use 'mediaURL', 'segB', 'segC', 'crossId1', 'crossId2' and 'hasAds'. These parameters can be left out completely from structure. They are optional and not mandatory (and out of current reporting too).
  
 
=== Ad Object ===
 
=== Ad Object ===

Revision as of 08:03, 4 October 2017

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 in 3rd parameter object Nielsen provided
vcid VCID value has to be passed 3rd parameter object Nielsen provided
nol_sdkDebug Enables Nielsen console logging. Only required for testing. in 3rd parameter object {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","myPlayerName", {clientid: "it-123456", vcid: "c01", 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?
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)
airdate Original (local) air date and time (hh:mm:ss as 24h time stamp); if not known set it to eg. "19700101 00:00:00" YYYYMMDD hh:mm:ss
isfullepisode Full episode flag

"y" - full episode "n" - non-full episode

adloadtype

Type of ad load:

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

"2" - Dynamic

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
subbrand subbrand/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
mediaURL URL location of the content being streamed custom
segB Segment B custom
segC Segment C custom
crossId1 Standard episode ID custom
crossId2 Content originator (required only for distributors) Nielsen provided
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:         '1020',
  airdate:        '19700101 00:00:00',
  isfullepisode:  'y',
  adloadtype:     '2'
};


Note: for Audiweb clients there is no need to use 'mediaURL', 'segB', 'segC', 'crossId1', 'crossId2' and 'hasAds'. These parameters can be left out completely from structure. They are optional and not mandatory (and out of current reporting too).

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. Use Event 5 to resume ...

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); // must be called as start of stream (even if 1st video is preroll)
 
// Preroll
nSdkInstance.ggPM('15', prerollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // Event 49 must be fired every second with playhead starting from 0
... /*** pass playhead every second ***/
nSdkInstance.ggPM('49', individualAdPlayheadPosition);
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
// Content
nSdkInstance.ggPM('5',  contentPlayheadPosition);
nSdkInstance.ggPM('49', contentPlayheadPosition); // Event 49 (playheadPosition) must be fired every second with playhead starting from 0 for the first segment (or with seconds since 1970-01-01 00:00:00 in case of livestream)
... /*** pass playhead every second ***/
nSdkInstance.ggPM('49', contentPlayheadPosition);
nSdkInstance.ggPM('6',  contentPlayheadPosition);
 
// Midroll
nSdkInstance.ggPM('15', midrollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // Event 49 must be fired every second with playhead starting from 0
... /*** pass playhead every second ***/
nSdkInstance.ggPM('49', individualAdPlayheadPosition);
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
// Content
nSdkInstance.ggPM('5',  contentPlayheadPosition);
nSdkInstance.ggPM('49', contentPlayheadPosition); // Event 49 has to be fired every second with playhead starting from where it left off before mid-roll (or with seconds since 1970-01-01 00:00:00 in case of livestream)
... /*** pass playhead every second ***/
nSdkInstance.ggPM('49', contentPlayheadPosition);
nSdkInstance.ggPM('6',  contentPlayheadPosition);
nSdkInstance.ggPM('57', contentPlayheadPosition);
 
// Postroll
nSdkInstance.ggPM('15', postrollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // Event 49 must be fired every second with playhead starting from 0
... /*** pass playhead every second ***/
nSdkInstance.ggPM('49', individualAdPlayheadPosition);
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
// End of Stream
nSdkInstance.ggPM('7',  contentPlayheadPosition); // must be called as indicator for end-of-stream


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 6 is used for handling pause. To indicate pause, stop passing the playhead position to the SDK and send Event 6 with playhead once. When content resumes, begin sending the playhead again with the correct playhead value. Also if buffering occurs for more than 1 second you may use Event 6 (pause) to indicate that. e.g. pause at 1m2s and resume after a couple of seconds:

...
nSdkInstance.ggPM('49', 61);
nSdkInstance.ggPM('49', 62);
nSdkInstance.ggPM('6', 62); // now send nothing to SDK until player resumes (automatically because of buffering ends or user unpauses/resumes play
nSdkInstance.ggPM('49', 63);
nSdkInstance.ggPM('49', 64);
...


Handling Seek The event 8 is used for handling forward/backward seek. To indicate seek, send Event 8 with 'from' and 'to' playhead. e.g. seek from 1m2s to 2m0s:

...
nSdkInstance.ggPM('49', 61);
nSdkInstance.ggPM('49', 62);
nSdkInstance.ggPM('8', 62,120);
nSdkInstance.ggPM('49', 120);
nSdkInstance.ggPM('49', 121);
...


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 'stop' for the ad
  if (insideMidroll) {
    nSdkInstance.ggPM('7', playheadPosition);
  }
  
  // Indicate 'end' for the content and 'stop' for the stream
  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");