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

From Engineering Client Portal

(Remove instant articles reference)
Line 178: Line 178:
  
 
'''Note''': all parameters should be provided as strings (also length)
 
'''Note''': all parameters should be provided as strings (also length)
 
'''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 17:03, 9 November 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, clientid and vcid is needed. These values are provided by Nielsen.

The App ID is a unique ID assigned to the player/site/app. This will be provided upon starting the integration.

AppID:

PXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX


The clientid is your 'parent# or companyid'

clientid:

XX-XXXXXX"

// eg. "it-123456"


The vcid is your channel id

vcid:

"xXX"

// eg. "c01"

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: "XX-XXXXXX",  // eg. "it-123456"
       vcid: "cXX",            // eg. "c01"
       nol_sdkDebug: "debug"   // should be deleted when going live
    }
)

When creating an instance, pass the following five values:

Parameter Description Values
apid Unique ID assigned to player/site "PXXXXXXXX-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[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");
 
  // Created SDK Instance
  var nSdkInstance = NOLBUNDLE.nlsQ("P14273221-CF5C-46BF-A832-994AEFB73AA4","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 (for Italy there is no need to tag ads)

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 (max. 40 characters) custom
program Program name (max. 254 characters) custom
title Episode title (max. 254 characters) 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 "1"
  2. Dynamic - Dynamic Ad Insertion (DAI) "2"
"1" - Linear

"2" - Dynamic

✓ (has to be "2" for DCR/Italy)
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

Example Content Object ... with all mandatory parameters - you may ignore the optional ones.

//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: all parameters should be provided as strings (also length)

Ad Object

The ad metadata should be passed for each individual ad.

Attention: for Audiweb there is no need to tag ads in video stream ... you may ignore this paragraph. If there are ads in your stream, but not tagged than simply do nothing while ad is playing.


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 Event Name Description
'3' content/ad metadata object load content metadata Load metadata event for content. Has to be called at the very first beginning of each stream.
'5' playhead position content play Call when content or ads start playing or resumes from pause.

VOD (or ad): The playhead position must be passed. Live: current unix timestamp (seconds since January 1st 1970).

'6' playhead position pause Call when content or ads is pausing. Use Event 5 to resume ...

VOD (or ad): The playhead position must be passed. Live: current unix timestamp (seconds since January 1st 1970).

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

Live: current unix timestamp (seconds since January 1st 1970). Note: has to be called on a secondly basis. For each ad the playheads starts with 0 (no Live unix timestamp for ads)

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

At the end of the content stream, if the user switches to another piece of content or 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.

without Ads


example without ads:

// Start of stream
nSdkInstance.ggPM('3', contentMetadataObject); // must be called as start of stream

// Content
nSdkInstance.ggPM('5',  contentPlayheadPosition);
nSdkInstance.ggPM('49', contentPlayheadPosition); // must be fired every second with playhead starting from 0 (or with seconds since 1970-01-01 00:00:00 in case of livestream)
... /*** pass playheads every second ***/
nSdkInstance.ggPM('49', contentPlayheadPosition);
nSdkInstance.ggPM('6',  contentPlayheadPosition);  // pause is also needed for legacy reasons before event 57
nSdkInstance.ggPM('57', contentPlayheadPosition);  // has to be called here at the end of the content only once
 
// End of Stream
nSdkInstance.ggPM('7',  contentPlayheadPosition); // must be called as indicator for end-of-stream

Note: if there are ads played in stream simply use a pause (event 6) when ads start playing and a play (event 5) when content start playing.


with Ads

example with ads:

// Start of stream
nSdkInstance.ggPM('3', contentMetadataObject); // must be called as start of stream (even if 1st asset is preroll)
 
// Preroll
nSdkInstance.ggPM('15', prerollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // 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); // 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 playheads every second ***/
nSdkInstance.ggPM('49', contentPlayheadPosition);
nSdkInstance.ggPM('6',  contentPlayheadPosition);
 
// Midroll
nSdkInstance.ggPM('15', midrollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // must be fired every second with playhead starting from 0
... /*** pass playheads every second ***/
nSdkInstance.ggPM('49', individualAdPlayheadPosition);
nSdkInstance.ggPM('7',  individualAdPlayheadPosition);
 
// Content
nSdkInstance.ggPM('5',  contentPlayheadPosition);
nSdkInstance.ggPM('49', contentPlayheadPosition); // must 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 playheads every second ***/
nSdkInstance.ggPM('49', contentPlayheadPosition);
nSdkInstance.ggPM('6',  contentPlayheadPosition);  // pause is also needed for legacy reasons before event 57
nSdkInstance.ggPM('57', contentPlayheadPosition);  // has to be called here at the end of the content only once
 
// Postroll
nSdkInstance.ggPM('15', postrollMetadataObject);
nSdkInstance.ggPM('49', individualAdPlayheadPosition); // 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


Attention: for Italy there is no need to tag ads in video stream ... ignore "with ads" example!


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: when buffering occurs you have to send a event 6 (pause) and after buffering finished a 5 (play).

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('5', 62); // play/5 when resume occurs (when user click play or buffering ends)
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('6', 62); // use pause, because buffering will occur (to be on safe side)
nSdkInstance.ggPM('8', 62,120);
nSdkInstance.ggPM('5', 120); // play/5 when resuming
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.

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 https://priv-policy.imrworldwide.com/priv/browser/it/it/optout.html.

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

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. 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("P14273221-CF5C-46BF-A832-994AEFB73AA4","myPlayerName", {clientid: "it-123456", vcid: "c01"});