DCR Video Browser SDK: Difference between revisions

From Engineering Client Portal

No edit summary
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}}  {{CurrentBreadcrumb}}
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|US DCR & DTVR}}  {{CurrentBreadcrumb}}
[[Category:Digital]]
[[Category:Digital]]


== Prerequisites ==
== Prerequisites ==
To start using the App SDK, the following items are required:
Before you start the integration, you will need:
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 10: Line 10:
! Description
! Description
! Source
! Source
|-
|-style="background-color:#d0f6f8;"
|| ☑ || '''App ID (appid)''' || Unique ID assigned to the player/site and configured by product. || Contact Nielsen
|| ☑ || '''App ID (appid)''' || Unique ID assigned to the player/site and configured by product. || Contact Nielsen
|}
|}
== Release Notes ==
The release notes on the Browser SDK can be located here: '''[[Browser SDK Release Notes|Release Notes]]'''


== Configure SDK ==
== Configure SDK ==
Line 23: Line 26:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
<script>
<script>
!function(t,n)
    // Static Queue Snippet
{
    !function (e, n) {
  t[n]=t[n]||
      function t(e) {
  {
        return "object" == typeof e ? JSON.parse(JSON.stringify(e)) : e
    nlsQ:function(e,o,c,r,s,i)
      }
    {
      e[n] = e[n] ||
    return s=t.document,
      {
    r=s.createElement("script"),
        nlsQ: function (o, r, c) {
    r.async=1,
          var s = e.document,
    r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
            a = s.createElement("script");
    i=s.getElementsByTagName("script")[0],
          a.async = 1,
    i.parentNode.insertBefore(r,i),
            a.src = ("http:" === e.location.protocol ? "http:" : "https:") + "//cdn-gl.imrworldwide.com/conf/" + o + ".js#name=" + r + "&ns=" + n;
    t[n][o]=t[n][o]||{g:c||{},
          var i = s.getElementsByTagName("script")[0];
    ggPM:function(e,c,r,s,i){(t[n][o].q=t[n][o].q||[]).push([e,c,r,s,i])}},t[n][o]
          return i.parentNode.insertBefore(a, i),
    }
            e[n][r] = e[n][r] || {
  }
              g: c || {},
}
              ggPM: function (o, c, s, a, i) { e[n][r].q = e[n][r].q || []; try { var l = t([o, c, s, a, i]); e[n][r].q.push(l) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } },
              trackEvent: function (o) { e[n][r].te = e[n][r].te || []; try { var c = t(o); e[n][r].te.push(c) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } }
            },
            e[n][r]
        }
      }
    }(window, "NOLBUNDLE");


(window,"NOLBUNDLE");


var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {
Line 52: Line 60:


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.
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.
<blockquote>For DCR static, BSDK cannot be run in an iframe because the blur/focus events of the parent page may not propagate to the iframe. The iframe events typically trigger when the iframe itself is clicked. The BSDK is dependent on the blur/focus events of the browser to detect active viewing of the page. Because the root page events do not propagate to the iframe, this would impact incorrect DCR static crediting.</blockquote>


===Create SDK Instance===
===Create SDK Instance===
Line 58: Line 68:
==== Initialization API Call ====
==== Initialization API Call ====
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug",optout: "false"});
NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"});
</syntaxhighlight>
</syntaxhighlight>
<br>
<br>
Line 77: Line 87:
</syntaxhighlight>
</syntaxhighlight>
|-
|-
|optout || OptOut global parameter (Optional Parameter) || <code>1/0</code> or <code>true/false</code>
|optout || Optional: OptOut global parameter. || <code>1/0</code> or <code>true/false</code>
|}
|}


Line 122: Line 132:
The configuration should include the Static Queue Snippet and an SDK Instance for an unique App ID as shown in the example:
The configuration should include the Static Queue Snippet and an SDK Instance for an unique App ID as shown in the example:
<syntaxhighlight lang="html"><script type="text/javascript">
<syntaxhighlight lang="html"><script type="text/javascript">
  // Add Static Queue Snippet
// Add Static Queue Snippet
!function(t,n)
    !function (e, n) {
{
      function t(e) {
  t[n]=t[n]||
        return "object" == typeof e ? JSON.parse(JSON.stringify(e)) : e
  {
      }
    nlsQ:function(e,o,c,r,s,i)
      e[n] = e[n] ||
    {
      {
    return s=t.document,
        nlsQ: function (o, r, c) {
    r=s.createElement("script"),
          var s = e.document,
    r.async=1,
            a = s.createElement("script");
    r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
          a.async = 1,
    i=s.getElementsByTagName("script")[0],
            a.src = ("http:" === e.location.protocol ? "http:" : "https:") + "//cdn-gl.imrworldwide.com/conf/" + o + ".js#name=" + r + "&ns=" + n;
    i.parentNode.insertBefore(r,i),
          var i = s.getElementsByTagName("script")[0];
    t[n][o]=t[n][o]||{g:c||{},
          return i.parentNode.insertBefore(a, i),
    ggPM:function(e,c,r,s,i){(t[n][o].q=t[n][o].q||[]).push([e,c,r,s,i])}},t[n][o]
            e[n][r] = e[n][r] || {
    }
              g: c || {},
  }
              ggPM: function (o, c, s, a, i) { e[n][r].q = e[n][r].q || []; try { var l = t([o, c, s, a, i]); e[n][r].q.push(l) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } },
}
              trackEvent: function (o) { e[n][r].te = e[n][r].te || []; try { var c = t(o); e[n][r].te.push(c) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } }
(window,"NOLBUNDLE");
            },
            e[n][r]
        }
      }
    }(window, "NOLBUNDLE");
   
   
  // Created SDK Instance
// Created SDK Instance
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {nol_sdkDebug: "debug"});
  nol_sdkDebug: "debug",
  optout: "false"
});
</script></syntaxhighlight>
</script></syntaxhighlight>


Line 159: Line 170:


==== Content Metadata ====
==== Content Metadata ====
Content metadata should remain constant throughout the completion of an episode / clip including the ads play.
Content metadata should remain constant throughout the entirety of an episode/clip including when ads play.
{| class="wikitable"
{{DCR Content Metadata}}
|-
! Key !! Description !! Values !! Required
|-
| clientid ||
parent ID – value is automatically populated through provided App ID.<br/>
In order to override the brand configured to the App ID, pass parent <br/>
value here and the sub-brand ID associated to that brand in the subbrand <br/>
key (e.g. multiple brands in App)
||
Nielsen provided
||
|-
| vcid || sub-brand ID – value is automatically populated through provided<br/>
App ID. In order to override the sub-brand configured to the App ID, value can <br/>
be passed here (e.g. multiple sub-brands in App)
||
Nielsen provided
||
|-
| type || type of asset || "content" || ✓
|-
| assetid || unique ID assigned to asset || custom<br>(no [[Special Characters]]) || ✓
|-
| program || name of program (511 character limit - Request URL should not exceed 2000 characters) || custom || ✓
|-
| title || episode title (511 character limit - Request URL should not exceed 2000 characters) || custom || ✓
|-
| length || length of content in seconds || seconds (0 for live stream)|| ✓
|-
| mediaURL || URL location of the content being streamed || custom ||
|-
| segB || custom segment B || custom ||
|-
| segC || custom segment C || custom ||
|-
| airdate || the airdate in the linear TV || YYYYMMDD HH:MI:SS || ✓
|-
| isfullepisode || full episode flag ||
*"y"– full episode
*"n"– non full episode
||
|-
| crossId1 || standard episode ID || custom || ✓
|-
| crossId2 || content originator (only required for distributors) || Nielsen provided ||
|-
|adloadtype || type of ad load:
* 1) Linear – matches TV ad load
* 2) Dynamic – Dynamic Ad Insertion (DAI)
||
*"1" – content with linear ads
*"2" – content with dynamic ads
||
|}


==== Example Content Object ====
==== Example Content Object ====
Line 223: Line 178:
{   
{   
   type:          'content',
   type:          'content',
   assetid:        'VID123-123456',
   assetid:        'VID-123456',
   program:        'program name',
   program:        'program name',
   title:          'episode title',
   title:          'episode title with season and episode number',
   length:        'length in seconds',
   length:        'length in seconds',
  mediaURL:      'http://www.site.com/videoAsset',
   airdate:        '20210321 09:00:00',
  segB:          'custom segment B',
  segC:          'custom segment C',
   airdate:        'YYYYMMDD HH:MI:SS',
   isfullepisode:  'y',
   isfullepisode:  'y',
   crossId1:      'Standard Episode ID',
  adloadtype:    '2',
   crossId2:      'Content Originator',
  segB:          'custom segment B', // optional
  adloadtype:    '2'
  segC:          'custom segment C', // optional
   crossId1:      'Standard Episode ID', // optional
   crossId2:      'Content Originator' //optional
};
};
</syntaxhighlight>
</syntaxhighlight>


=== Ad Metadata Object ===
=== Ad Metadata ===
The ad metadata should be passed for each individual ad.
The Ad Metadata (if applicable) should be passed for each individual ad.
 
{| class="wikitable"
{| class="wikitable"
|-
|-
! Keys !! Description !! Values !! Required
! Keys !! Description !! Values !! Required
|-
|-
| type || type of ad || 'preroll', 'midroll', or 'postroll' || ✓
| type || type of Ad || <code>'preroll'</code>, <code>'midroll'</code>, <code>'postroll'</code> <br> <code>'ad'</code>  - If specific type can not be identified.|| ✓
|-
|-
| assetid || unique ID assigned to ad || custom || ✓
| assetid || unique ID assigned to Ad || custom <br>(no [[Special Characters]]) || ✓
|}
|}


Line 254: Line 207:
var adMetadataObject =  
var adMetadataObject =  
{   
{   
   assetid: 'AD-1',
   type:   'preroll',
   type:   'preroll'
   assetid: 'AD-1'
};
};
</syntaxhighlight>
</syntaxhighlight>
Line 279: Line 232:
* Leaving the page to another destination
* Leaving the page to another destination
* Pressing the stop button
* Pressing the stop button
* Network Loss


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).
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).
Line 310: Line 264:
Pass playhead position every second during playback
Pass playhead position every second during playback
|-
|-
| 'stop' || playhead position || Call when content or ads complete playing and pass playhead position
| 'stop' || playhead position in seconds || Call when content or ads complete playing and pass playhead position
|-
|-
| 'end' || playhead position in seconds || Call when the current video asset completes playback and pass the playhead position. <br/>
| 'end' || playhead position in seconds || Call when the current video asset completes playback and pass the playhead position. <br/>
Line 317: Line 271:


== SDK Playhead Event Sequence ==
== SDK Playhead Event Sequence ==
The sample event lifecycle can be used as a reference for identifying the order for calling events.
The sample event lifecycles can be used as a reference for identifying the order for calling events.
 
=== Content Playback ===
<syntaxhighlight lang="javascript">
// START OF STREAM
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
// CONTENT PLAYS
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
// 
//  pass playhead every second
// 
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);


// END OF STREAM
nSdkInstance.ggPM('end', playheadPosition);
</syntaxhighlight>
=== Content Playback with Ads ===
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// START OF STREAM
// START OF STREAM
Line 350: Line 322:
nSdkInstance.ggPM('stop', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
   
   
// CONTENT
// CONTENT RESUMES
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
Line 356: Line 328:
//  pass playhead every second
//  pass playhead every second
//   
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
// END OF STREAM
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('end', playheadPosition);
nSdkInstance.ggPM('end', playheadPosition);
Line 381: Line 356:
After the integration has been certified, users will need to make a couple of updates to the initialization call to ensure that player will be measured properly.
After the integration has been certified, users will need to make a couple of updates to the initialization call to ensure that player will be measured properly.
Disable debug logging by deleting {nol_sdkDebug: 'DEBUG'} from initialization call.
Disable debug logging by deleting {nol_sdkDebug: 'DEBUG'} from initialization call.
Example Production Initialization Call
 
'''Example Production Initialization Call'''


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", { optout: "false"});
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", { optout: "false"});
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 20:22, 3 September 2024

Engineering Portal / Digital / US DCR & DTVR / DCR Video Browser SDK

Prerequisites

Before you start the integration, you will need:

Item Description Source
App ID (appid) Unique ID assigned to the player/site and configured by product. Contact Nielsen

Release Notes

The release notes on the Browser SDK can be located here: Release Notes

Configure SDK

There are two steps required for configuring the SDK:

  • Add Static Queue Snippet
  • Create SDK Instance

Static Queue Snippet

Add the following script tag to the website:

<script>
    // Static Queue Snippet
    !function (e, n) {
      function t(e) {
        return "object" == typeof e ? JSON.parse(JSON.stringify(e)) : e
      }
      e[n] = e[n] ||
      {
        nlsQ: function (o, r, c) {
          var s = e.document,
            a = s.createElement("script");
          a.async = 1,
            a.src = ("http:" === e.location.protocol ? "http:" : "https:") + "//cdn-gl.imrworldwide.com/conf/" + o + ".js#name=" + r + "&ns=" + n;
          var i = s.getElementsByTagName("script")[0];
          return i.parentNode.insertBefore(a, i),
            e[n][r] = e[n][r] || {
              g: c || {},
              ggPM: function (o, c, s, a, i) { e[n][r].q = e[n][r].q || []; try { var l = t([o, c, s, a, i]); e[n][r].q.push(l) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } },
              trackEvent: function (o) { e[n][r].te = e[n][r].te || []; try { var c = t(o); e[n][r].te.push(c) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } }
            },
            e[n][r]
        }
      }
    }(window, "NOLBUNDLE");


var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {
  nol_sdkDebug: "debug",
  optout: "false"
});

</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.

For DCR static, BSDK cannot be run in an iframe because the blur/focus events of the parent page may not propagate to the iframe. The iframe events typically trigger when the iframe itself is clicked. The BSDK is dependent on the blur/focus events of the browser to detect active viewing of the page. Because the root page events do not propagate to the iframe, this would impact incorrect DCR static crediting.

Create SDK Instance

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

Initialization API Call

NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"});


When creating an instance, pass the following values: (nol_sdkDebug and optout are optional)

Parameter Description Values
apid Unique ID assigned to player/site 'PXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
instanceName Name of SDK instance "any string value"
nol_sdkDebug Enables Nielsen console logging if desired.
{nol_sdkDebug: "debug"} 
{nol_sdkDebug: "info"}
{nol_sdkDebug: "warn"}
{nol_sdkDebug: "true"}
optout Optional: OptOut global parameter. 1/0 or true/false

Example SDK Initialization

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: “nlsSDK600.bundle.min.js”.

More information on OptOut Parameter under Privacy and Opt-Out.

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 (e, n) {
      function t(e) {
        return "object" == typeof e ? JSON.parse(JSON.stringify(e)) : e
      }
      e[n] = e[n] ||
      {
        nlsQ: function (o, r, c) {
          var s = e.document,
            a = s.createElement("script");
          a.async = 1,
            a.src = ("http:" === e.location.protocol ? "http:" : "https:") + "//cdn-gl.imrworldwide.com/conf/" + o + ".js#name=" + r + "&ns=" + n;
          var i = s.getElementsByTagName("script")[0];
          return i.parentNode.insertBefore(a, i),
            e[n][r] = e[n][r] || {
              g: c || {},
              ggPM: function (o, c, s, a, i) { e[n][r].q = e[n][r].q || []; try { var l = t([o, c, s, a, i]); e[n][r].q.push(l) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } },
              trackEvent: function (o) { e[n][r].te = e[n][r].te || []; try { var c = t(o); e[n][r].te.push(c) } catch (e) { console && console.log && console.log("Error: Cannot register event in Nielsen SDK queue.") } }
            },
            e[n][r]
        }
      }
    }(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 entirety of an episode/clip including when ads play.

Keys Description Values Required Provider
type Type of asset For Video use: content
For Static or text static
Yes Nielsen
assetid Unique ID assigned to asset
Note: Refrain from using the following special characters (Special Characters).
Examples:
BBT345a234
CBSs5e234F2021
Yes Client
program Complete program or movie title
(no abbreviations or shorthand)
Note: there is a 25 character limit.
The Big Bang Theory
TheBigBangTheory
The Dark Knight
TheDarkKnight
Yes Client
title Episode title with season and episode number (40 character limit)
(Formats accepted: S01E03, S1E3, S1 E3).
Examples:
The Pants Alternative S03E18
The Pants Alternative S3E18
The Pants Alternative S3 E18
Can also accept: S3E18
Not Valid: 318 or 0318
Yes Client
crossId1 Gracenote TMS ID (If available) should be passed for all telecasted content for clients using the Gracenote solution for proper matching purposes.
Note: The TMS ID will be a 14 character string. Normally leading with 2 alpha characters ('EP', 'MV', 'SH' or 'SP'), followed by 12 numbers.
The TMS ID will be a 14 character string.
Normally being with 'EV,' 'EP', 'SH', 'SP', or 'MV'
Followed by 12 numbers after the initial two letter prefix.

The Giant Morning Show: SH009311820022
The Pants Alternative Episode : EP009311820061
Optional Nielsen
crossId2 Populated by content distributor to contribute viewing from that distributor to the given content originator. Custom
For a full list of acceptable values, please contact your Nielsen reprentative.
Yes, for distributors Nielsen
length Length of content in seconds
Note: Integers and decimal values are acceptable for the length parameter.
Examples:

For standard VOD content - 300 to represent 5 minutes, 1320 to represent 22 minutes, etc.
If DAI live stream of a discrete program (Live Event/Sporting Event), pass length of content. See example for standard VOD content above.
If unknown DAI live steam, pass a value of 0.

Yes Client
airdate Original broadcast or release date for the program
For USA, date should be EST
Outside USA, date should be local time.
If not applicable or available, original broadcast or release date for the Program.
Acceptable Formats:
YYYY-MM-DDTHH:MI:SS
YYYY-MM-DDHH:MI:SS
YYYY-MM-DDTHH:MI:SS+xx:xx
YYYY-MM-DDTHH:MI:SS-xx:xx
YYYYMMDDHH:MI:SS
YYYYMMDD HH:MI:SS
MM-DD-YYYY
MM/DD/YYYY
YYYYMMDD
Yes Client
isfullepisode Full episode flag to identify differences between long form content. y- full episode, n- non full episode(clip,teaser,promo,etc.)

Also accept:
lf or yes- longform
sf or no- shortform

Yes Nielsen
adloadtype Type of ad load:

1 Linear – matches TV ad load
2 Dynamic – Dynamic Ad Insertion (DAI)

2 - DCR measures content with dynamic ads Yes Nielsen
segB One of two custom segment for the clients granular reporting within a brand. Examples:
Genre - horror, comedy, etc.
Timeslot - primetime, daytime, etc.
News type - breakingnews, weather, etc.
Optional Client
segC One of two custom segment for the clients granular reporting within a brand. Examples:
Genre - horror, comedy, etc.
Timeslot - primetime, daytime, etc.
News type - breakingnews, weather, etc.
Optional Client

Custom segments (segB and segC) can be used to aggregate video and/or static content within a single Brand to receive more granular reports within a brand.

Examples regarding usage of segments within SDK:

  • All comedy clips and stories for a Brand rolled into a "Comedy" segment
  • genre grouping content by Comedy vs. Drama
  • group related Text + Video content - i.e. for a show that has a lot of - static pages associated with it
  • packaging based on how clients sell inventory
  • grouping related types of content either by genre, category or platform.


Example Content Object

var contentMetadataObject =
{  
  type:           'content',
  assetid:        'VID-123456',
  program:        'program name',
  title:          'episode title with season and episode number',
  length:         'length in seconds',
  airdate:        '20210321 09:00:00',
  isfullepisode:  'y',
  adloadtype:     '2',
  segB:           'custom segment B', // optional
  segC:           'custom segment C', // optional
  crossId1:       'Standard Episode ID', // optional
  crossId2:       'Content Originator' //optional
};

Ad Metadata

The Ad Metadata (if applicable) should be passed for each individual ad.

Keys Description Values Required
type type of Ad 'preroll', 'midroll', 'postroll'
'ad' - If specific type can not be identified.
assetid unique ID assigned to Ad custom
(no Special Characters)

Example Ad Object

var adMetadataObject = 
{  
  type:    'preroll',
  assetid: 'AD-1'
};


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, ...);

Interrupt Scenarios

Pause Event

The setPlayheadPostion event 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.

Other Interrupt Scenarios

The following possible browser interruption scenarios must be handled:

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

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

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

SDK Events

Event Parameter Description
'loadMetadata' content/ad metadata object Needs to be called at the beginning of each asset
'setPlayheadPosition' playhead position as integer

VOD: || current position in seconds
Live: current Unix timestamp (seconds since Jan-1-1970 UTC)
Note: 'setPlayheadPosition' has to be called every second

Pass playhead position every second during playback

'stop' playhead position in seconds Call when content or ads complete playing and pass playhead position
'end' playhead position in seconds Call when the current video asset completes playback and pass the playhead position.

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 Playhead Event Sequence

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

Content Playback

// START OF STREAM
nSdkInstance.ggPM('loadMetadata', contentMetadataObject); 
 
// CONTENT PLAYS
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);

// END OF STREAM
nSdkInstance.ggPM('end', playheadPosition);


Content Playback with Ads

// START OF STREAM
nSdkInstance.ggPM('loadMetadata', contentMetadataObject); 
 
// PREROLL
nSdkInstance.ggPM('loadMetadata', prerollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
 
// CONTENT
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);

// MIDROLL
nSdkInstance.ggPM('loadMetadata', midrollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
 
// CONTENT RESUMES
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);

// END OF STREAM
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('end', playheadPosition);
 
// POSTROLL
nSdkInstance.ggPM('loadmetadata', postrollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
  • 'setPlayheadPosition' 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 'stop', 'end', or 'loadmetadata'.
  • For Ad Pods, events must be called for each individual Ad. Each Ad playhead position should begin at ‘0’ when ad starts.
  • 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.

Privacy and Opt-Out

There are two primary methods for implementing user Opt-out preferences:

  1. User Opt Out - Provide a link to the Nielsen Privacy Policy page when a User can make their selection
  2. Initialization Opt Out - Global OptOut Parameter

User 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 User Opt-Out option, include the following two items in your privacy policy.

  • A notice that the player (or page in relation to static measurement) 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 https://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.

  • Once users have opted out via this link, their browser cookies will contain the value TOTAL_OPTOUT. This will prevent a redirect to our data provider from occurring
  • Users can opt back in via this link. When a user selects that link, their opt-out cookie will be deleted and they will be able to be measured moving forward.


The following paragraph is a template for a Privacy 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://www.nielsen.com/digitalprivacy

User 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.

Initialization Opt Out

The BSDK600 now supports the ability to optout on initialization of the SDK by allowing an optout global parameter to be passed. This optout will be maintained through the session of the SDK instance. Specifications and limitations are specified below.

Type Supported Values Notes Optout
optout True, Yes, or 1 Case is insensitive and can be string or bool

Example: nlsQ("XXXXXXXX-BH45-JKY6-BKH7-67GJKY68GJK7", "myInstance", { optout: true});

Ping parameter will set uoo=true.
optout False, No, or 0 Case is insensitive and can be string or bool

Example: nlsQ("XXXXXXXX-BH45-JKY6-BKH7-67GJKY68GJK7", "myInstance", { optout: false});

Ping parameter will set uoo to blank.

Example of using OptOut

var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {
  nol_sdkDebug: "debug",
  optout: "true"
});

Opt Out Overview

Browser Cookie uoo value in session ping Final Optout Status
Default Value no uoo value or uoo=0 Not Opted Out
Default Value uoo=1 Opted Out
TOTAL_OPTOUT uoo=0 Opted Out
TOTAL_OPTOUT uoo=1 Opted Out

Going Live

After the integration has been certified, users will need to make a couple of updates to the initialization call to ensure that player will be measured properly. Disable debug logging by deleting {nol_sdkDebug: 'DEBUG'} from initialization call.

Example Production Initialization Call

var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", { optout: "false"});