DCR Italy Video Browser SDK (6.0.0)
From Engineering Client Portal
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.
apid: "XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" // eg. PDA7D5EE6-B1B8-XXXX-XXXX-2A788BCXXXCA
- The clientid is your 'parent' or company id'
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 type="text/javascript">
!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 API 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 values:
Parameter | Description | Required | Values |
---|---|---|---|
apid | Unique ID assigned to player/site.
|
Yes | 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' |
instanceName | Name of SDK instance | Yes | "any string value" |
clientid | Brand value has to be passed in 3rd parameter object | Yes | Nielsen provided |
vcid | VCID value has to be passed 3rd parameter object | Yes | Nielsen provided |
nol_sdkDebug | Enables Nielsen console logging. Only required for testing | Yes | 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: “nlsSDK600.bundle.min.js”.
Example SDK Initialization API Call
var nSdkInstance = NOLBUNDLE.nlsQ("P14273221-CF5C-46BF-A832-994AEFB73AA4","myPlayerName", {clientid: "it-123456", vcid: "c01", nol_sdkDebug: "DEBUG"});
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
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 asset | "content" | ✓ |
assetid | Unique ID assigned to content (max. 40 characters) | custom | ✓ |
program | Name of program (25 characters limit) | custom | ✓ |
title | Episode title (40 characters limit) | custom | ✓ |
length | Length of content in seconds for VOD (Video on demand). The value for live stream content is 86400 |
|
✓ |
airdate | The airdate in the linear TV. 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 |
|
✓ |
adloadtype | type of ad load:
|
|
✓ (has to be "2" for DCR/Italy) |
Example Content Object
Note: all parameters should be provided as strings (also length)
//create content object
var contentMetadataObject =
{
type: 'content',
assetid: 'VID123-123456',
program: 'program name',
title: 'episode title',
length: '1020', // length in seconds (String)
airdate: '19700101 00:00:00',
isfullepisode: 'y',
adloadtype: '2'
};
Ad Metadata Object
The ad metadata should be passed for each individual ad, if ads are available during or before the stream (content) begins.
Keys | Description | Values | Required |
---|---|---|---|
type | type of ad | 'preroll', 'midroll', or 'postroll' | ✓ |
assetid | unique ID assigned to ad | custom | ✓ |
Example Ad Object
//create pre-roll ad object
var prerollMetadataObject =
{
assetid: 'AD-1',
type: 'preroll'
};
Call Nielsen APIs
The method for calling events is ggPM().
nSdkInstance.ggPM('event', parameter);
Events
The events are included in the table below:
Event name | Values to pass | Description |
---|---|---|
'loadMetadata' | content/ad metadata object | Needs to be called at the beginning of each content/ad metadata object |
'setPlayheadPosition' |
|
Pass playhead position every second during playback |
'stop' | playhead position in seconds | Call when ads complete playing and at the very end of the stream. The playhead position must be passed when calling stop |
'end' | playhead position in seconds | 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. |
Note: Playhead position as integer
Note: 'setPlayheadPosition' has to be called every second
Example Events
- Event: loadMetadata | Value Pass ( Object ): Content Metadata Object
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
- Event: loadMetadata | Value Pass ( Object ): Pre-roll AD Metadata Object
nSdkInstance.ggPM('loadMetadata', prerollMetadataObject);
- Event: setPlayheadPosition | Value Pass ( Integer ): playheadPosition
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
- Event: stop | Value Pass ( Integer ): stopPlayheadPosition
nSdkInstance.ggPM('stop', stopPlayheadPosition);
- Event: end | Value Pass ( Integer ): endPlayheadPosition
nSdkInstance.ggPM('end', endPlayheadPosition);
SDK Event Lifecycle
The sample event lifecycle can be used as a reference for identifying the order for calling events.
Note
- For Audiweb there is no need to tag ads in video stream ... please see 1st example how to use without ads!
without Ads
Event Lifecycle without ads:
Example without ads:
// START OF STREAM
nSdkInstance.ggPM('loadMetadata', contentMetadataObject); // must be called as start of stream
// CONTENT
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); // 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('setPlayheadPosition', lastPlayheadPosition);
// END OF STREAM
nSdkInstance.ggPM('end', endPlayheadPosition); // has to be called here at the end of the content
// endPlayheadPosition = lastPlayheadPosition
with Ads
Event Lifecycle with ads:
Example with ads:
// START OF STREAM
nSdkInstance.ggPM('loadMetadata', contentMetadataObject); // must be called as start of stream (even if 1st asset is preroll)
// PREROLL
nSdkInstance.ggPM('loadMetadata', prerollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); // must be fired every second with playhead starting from 0
... /*** pass playhead every second ***/
nSdkInstance.ggPM('setPlayheadPosition', lastPlayheadPosition); // end pre-roll stream
nSdkInstance.ggPM('stop', stopPlayheadPosition); // stopPlayheadPosition = lastPlayheadPosition
// CONTENT
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); // must be fired every second with playhead starting from 0 for the first segment (or with seconds since 1970-01-01 00:00:00 in case of livestream)
... /*** pass playhead every second ***/
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
// MIDROLL
nSdkInstance.ggPM('loadMetadata', midrollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); // must be fired every second with playhead starting from 0
... /*** pass playhead every second ***/
nSdkInstance.ggPM('setPlayheadPosition', lastPlayheadPosition); // end mid-roll stream
nSdkInstance.ggPM('stop', stopPlayheadPosition); // stopPlayheadPosition = lastPlayheadPosition
// CONTENT
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); // 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 playhead every second ***/
nSdkInstance.ggPM('setPlayheadPosition', lastPlayheadPosition);
nSdkInstance.ggPM('end', endPlayheadPosition); // has to be called here at the end of the content
// endPlayheadPosition = lastPlayheadPosition
// POSTROLL
nSdkInstance.ggPM('loadmetadata', postrollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition); // must be fired every second with playhead starting from 0
... /*** pass playhead every second ***/
nSdkInstance.ggPM('setPlayheadPosition', lastPlayheadPosition); // end post-roll stream
// END OF STREAM
nSdkInstance.ggPM('stop', stopPlayheadPosition); // stopPlayheadPosition = lastPlayheadPosition
Note: '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'.
Note : For Ad, 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.
Note: For pre-roll ads you have to call the loadMetadata event for content at the start of stream and after the preroll
Nielsen Opt-Out
The site must provide a means for the user to opt-out of, or opt back into, Nielsen Measurement. A user can opt-out if they would prefer not to participate in any Nielsen online measurement research. To implement the opt-out option, include the following two items in your privacy policy.
- A notice that the player includes proprietary measurement software that allows users to contribute to market research (such as Nielsen TV Ratings).
- A link to the Nielsen Digital Measurement Privacy Policy at https://priv-policy.imrworldwide.com/priv/browser/it/it/optout.html.
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.
- 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"});