DCR Video Browser SDK
From Engineering Client Portal
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>
!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");
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(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("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 - |
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:
|
Yes | Nielsen |
adloadtype | Type of ad load:
|
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 |
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:
- User Opt Out - Provide a link to the Nielsen Privacy Policy page when a User can make their selection
- 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"});