DCR Video Browser SDK: Difference between revisions
From Engineering Client Portal
(xx) |
AnkitAgrawal (talk | contribs) |
||
(74 intermediate revisions by 12 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 == | ||
Before you start the integration, you will need: | |||
{| class="wikitable" | |||
|- | |||
! style="width: 30px;" | | |||
! style="width: 15%;" | Item | |||
! Description | |||
! Source | |||
|-style="background-color:#d0f6f8;" | |||
|| ☑ || '''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 == | ||
There are two steps required for configuring the SDK: | There are two steps required for configuring the SDK: | ||
*Add Static Queue Snippet | *Add Static Queue Snippet | ||
*Create SDK Instance | *Create SDK Instance | ||
=== Static Queue Snippet === | |||
Add the following script tag to the website: | Add the following script tag to the website: | ||
<syntaxhighlight lang="javascript"> | |||
<syntaxhighlight lang="javascript"> | |||
<script> | <script> | ||
!function( | // 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(" | var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", { | ||
nol_sdkDebug: "debug", | |||
optout: "false" | |||
}); | |||
</script> | </script> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
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=== | ||
To initialize the SDK, create an SDK instance by making the initialization call: | To initialize the SDK, create an SDK instance by making the initialization call: | ||
==== Initialization API Call ==== | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"}) | NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"}); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br | <br> | ||
When creating an instance, pass the following | When creating an instance, pass the following values: (<code>nol_sdkDebug</code> and <code>optout</code> are optional) | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 66: | Line 80: | ||
|instanceName || Name of SDK instance || "any string value" | |instanceName || Name of SDK instance || "any string value" | ||
|- | |- | ||
| nol_sdkDebug || Enables Nielsen console logging. | | nol_sdkDebug || Enables Nielsen console logging if desired. || <syntaxhighlight lang="javascript"> | ||
{nol_sdkDebug: "debug"} | |||
{nol_sdkDebug: "info"} | |||
{nol_sdkDebug: "warn"} | |||
{nol_sdkDebug: "true"} | |||
</syntaxhighlight> | |||
|- | |||
|optout || Optional: OptOut global parameter. || <code>1/0</code> or <code>true/false</code> | |||
|} | |} | ||
< | ==== 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 [[DCR Video Browser SDK#Privacy_and_Opt-Out|Privacy and Opt-Out.]] | |||
<!-- | |||
==== Example SDK Initialization with Viewability ==== | |||
If you decide to implement the Nielsen Viewability Module, the SDK will track the viewability of the targeted player/element, log the viewable percentage and record in seconds the time the player/element was in that viewable state. The only additional information required is the HTML element ID of the element being tracked (which is passed during SDK Initialization), and the volume level (passed as an event). | |||
<syntaxhighlight lang="javascript"> | |||
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", { | |||
nol_sdkDebug: "debug", | |||
optout: "false" | |||
}); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
If no "volume" event is passed, a default value of '1' will be used. (IE: 100%). If the volume level is adjusted, the modified value can be passed to the SDK using the standard ggPM() API along with the new "volume" event. | |||
<br /> | |||
<syntaxhighlight lang="javascript"> | |||
nSdkInstance.ggPM("volume", <volume level>); | |||
</syntaxhighlight> | |||
<br /> | |||
{| class="wikitable" | |||
|- | |||
! Event Name !! Event # !! Purpose !! Possible Values !!Example | |||
|- | |||
| volume || 61 ||ggPM event that will allow clients to pass in the volume levels. ||Supports decimal values in range from 0 - 1||instance.ggPM("61", 0); => muted | |||
instance.ggPM("61", .5) => not muted | |||
intance.ggPM("61", 1) => not muted | |||
|} | |||
Sample: | |||
<syntaxhighlight lang="javascript"> | |||
nSdkInstance.ggPM("volume", 0); // muted | |||
</syntaxhighlight> | </syntaxhighlight> | ||
--> | |||
=== 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: | |||
<syntaxhighlight lang="html"><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></syntaxhighlight> | |||
=== Create Metadata Objects === | === Create Metadata Objects === | ||
There are two types of asset metadata: | There are two types of asset metadata: | ||
*content: identify video | *content: identify video | ||
*ad: identify each ad | *ad: identify each ad | ||
The metadata received for each asset is used for classification and reporting. | 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. | 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. | |||
Content metadata should remain constant throughout the | {{DCR Content Metadata}} | ||
{ | ==== Example Content Object ==== | ||
<syntaxhighlight lang="javascript"> | |||
<syntaxhighlight lang="javascript"> | |||
var contentMetadataObject = | var contentMetadataObject = | ||
{ | { | ||
type: 'content', | type: 'content', | ||
assetid: ' | 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', | ||
airdate: '20210321 09:00:00', | |||
airdate: ' | |||
isfullepisode: 'y', | isfullepisode: 'y', | ||
adloadtype: '2', | adloadtype: '2', | ||
segB: 'custom segment B', // optional | |||
segC: 'custom segment C', // optional | |||
crossId1: 'Standard Episode ID', // optional | |||
crossId2: 'Content Originator' //optional | |||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Ad Metadata | === Ad Metadata === | ||
The Ad Metadata (if applicable) should be passed for each individual ad. | |||
The | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Keys !! Description !! Values !! Required | ! Keys !! Description !! Values !! Required | ||
|- | |- | ||
| type || type of | | 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 | | assetid || unique ID assigned to Ad || custom <br>(no [[Special Characters]]) || ✓ | ||
|} | |} | ||
==== Example Ad Object ==== | |||
<syntaxhighlight lang="javascript"> | |||
<syntaxhighlight lang="javascript"> | |||
var adMetadataObject = | var adMetadataObject = | ||
{ | { | ||
type: 'preroll', | |||
assetid: 'AD-1' | |||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br/> | <br/> | ||
<blockquote> 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. </blockquote> | <blockquote> 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. </blockquote> | ||
==== Call Nielsen APIs ==== | |||
The method for calling events is ggPM(). | The method for calling events is ggPM(). | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
nSdkInstance.ggPM('event', parameter, ...); | nSdkInstance.ggPM('event', parameter, ...); | ||
</syntaxhighlight> | |||
== Interrupt Scenarios == | == Interrupt Scenarios == | ||
=== Pause Event === | === 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. | 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 === | === Other Interrupt Scenarios === | ||
The following possible browser interruption scenarios must be handled: | The following possible browser interruption scenarios must be handled: | ||
Line 257: | 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). | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
window.addEventListener('beforeunload', function(event) | window.addEventListener('beforeunload', function(event) | ||
{ | { | ||
Line 271: | Line 247: | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <blockquote>'''Note:''' User may need to add code to support specific browser versions (e.g. older versions of Internet Explorer).</blockquote> | ||
''' | |||
< | === SDK Events === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 286: | Line 259: | ||
| 'setPlayheadPosition' || playhead position as integer<br/> | | 'setPlayheadPosition' || playhead position as integer<br/> | ||
VOD: || current position in seconds <br/> | VOD: || current position in seconds <br/> | ||
Live: current UTC | Live: current Unix timestamp (seconds since Jan-1-1970 UTC) <br/> | ||
Note: 'setPlayheadPosition' has to be called every second | Note: 'setPlayheadPosition' has to be called every second | ||
|| | || | ||
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/> | ||
Example: At the end of the content stream, if the user switches to another piece of content, when the browser is refreshed or closed. | 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 == | == SDK Playhead Event Sequence == | ||
The sample event lifecycles can be used as a reference for identifying the order for calling events. | |||
The sample event | |||
< | === Content Playback === | ||
<syntaxhighlight lang="javascript"> | <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"> | |||
// START OF STREAM | // START OF STREAM | ||
nSdkInstance.ggPM('loadMetadata', contentMetadataObject); | nSdkInstance.ggPM('loadMetadata', contentMetadataObject); | ||
Line 321: | Line 311: | ||
// | // | ||
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); | nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); | ||
nSdkInstance.ggPM('stop', playheadPosition); | |||
// MIDROLL | // MIDROLL | ||
nSdkInstance.ggPM('loadMetadata', midrollMetadataObject); | nSdkInstance.ggPM('loadMetadata', midrollMetadataObject); | ||
Line 331: | 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 337: | 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 348: | Line 342: | ||
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); | nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); | ||
nSdkInstance.ggPM('stop', playheadPosition); | nSdkInstance.ggPM('stop', playheadPosition); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<blockquote> | <blockquote> | ||
Line 358: | Line 351: | ||
</blockquote> | </blockquote> | ||
{{Template:Browser_Privacy_and_Opt-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. | 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''' | |||
<syntaxhighlight lang="javascript"> | |||
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", { optout: "false"}); | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 20:22, 3 September 2024
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 - |
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"});