DCR Ireland Video Browser SDK: Difference between revisions
From Engineering Client Portal
WilsonQuispe (talk | contribs) No edit summary |
WilsonQuispe (talk | contribs) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 129: | Line 129: | ||
==== 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 completion of an episode / clip including the ads play. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 142: | Line 141: | ||
| title || Episode title (100 characters limit) || custom || Yes | | title || Episode title (100 characters limit) || custom || Yes | ||
|- | |- | ||
| length || Length of content in seconds | | length || length of content in seconds || | ||
Length of content in seconds (86400 seconds for live stream (24/7). For Event-Live streams planned length. For VoD video length) | |||
|| | || | ||
Yes | Yes | ||
Line 164: | Line 162: | ||
|| | || | ||
Yes | Yes | ||
|- | |||
| segB || custom segment for the clients granular reporting within a brand | |||
|| Example: ChannelName | |||
|| Optional | |||
|- | |||
| segC || custom segment for the clients granular reporting within a brand | |||
|| Example: PlayerName | |||
|| Optional | |||
|} | |} | ||
Line 179: | Line 185: | ||
isfullepisode: 'y', | isfullepisode: 'y', | ||
adloadtype: '2' | adloadtype: '2' | ||
segB: 'ChannelName', // optional | |||
segC: 'PlayerName', // optional | |||
} | } | ||
Line 191: | Line 199: | ||
| type || type of Ad || <code>'preroll'</code>, <code>'midroll'</code>, <code>'postroll'</code> || Yes | | type || type of Ad || <code>'preroll'</code>, <code>'midroll'</code>, <code>'postroll'</code> || Yes | ||
|- | |- | ||
| assetid || unique ID assigned to Ad || custom || Yes | | assetid || unique ID assigned to Ad || custom <br>(no [[Special Characters]]) || Yes | ||
|} | |} | ||
Line 361: | Line 369: | ||
In order to disclose Nielsen measurement privacy statement, please include the following items in your privacy policy: | In order to disclose Nielsen measurement privacy statement, please include the following items in your privacy policy: | ||
* A notice that the player includes third party measurement software that allows users to contribute to market research with anonymous data. | * A notice that the player includes third party measurement software that allows users to contribute to market research with anonymous data. | ||
* A link to the Nielsen Digital Measurement Privacy Policy located at https:// | * A link to the Nielsen Digital Measurement Privacy Policy located at https://global.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=en-ie (There is also a version in Irish available: https://global.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=ga ) | ||
== Test your player by yourself == | == Test your player by yourself == |
Latest revision as of 09:57, 2 December 2022
Overview
The Nielsen SDK is one of multiple framework SDKs that Nielsen provides to enable measuring linear (live) and on-demand TV viewing using TVs, mobile devices, etc. The Browser SDK is the framework for browsers developers to integrate Nielsen Measurement into their media player pages. It supports a variety of Nielsen Measurement Products like Digital in TV Ratings, Digital Content Ratings (DCR & DTVR).
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 |
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>
/* NLSQUEUE build v*/
!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.nmrodam.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("PXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance");
</script>
The static queue snippet allows the SDK APIs to be called while the actual SDK and configuration file are still being downloaded. As the queue can capture all API calls before the download completes, there is no wait time. Once the SDK is available, the API calls will transition from directing to the queue to the SDK seamlessly.
Create SDK Instance
To initialize the SDK, create an SDK instance by making the initialization call:
Initialization API Call
NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"})
When creating an instance, pass the following three values:
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. Only required for testing (not in production) | "{nol_sdkDebug: "debug"})" |
Example SDK Initialization
var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {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.eu.bundle.min.js”.
Example SDK Configuration
The configuration should include the Static Queue Snippet and an SDK Instance for an unique AppID 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.nmrodam.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("PXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", {nol_sdkDebug: "DEBUG"});
</script>
Create Metadata Objects
Before starting any measurement of an asset(Content or Ad) with the created SDK Instance, you need to create an asset metadata object in order to identify the asset. There are two types of asset metadata:
content: identify a video ad: identify each ad The metadata received for each asset is used for classification and reporting.
Metadata are passed through key-values using the Nielsen reserved keys. You 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" | Yes |
assetid | Unique ID assigned to content (32 character limit) | custom (no Special Characters) |
Yes |
program | Name of program (100 characters limit) | custom | Yes |
title | Episode title (100 characters limit) | custom | Yes |
length | length of content in seconds |
Length of content in seconds (86400 seconds for live stream (24/7). For Event-Live streams planned length. For VoD video length) |
Yes |
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 | Yes |
isfullepisode | Full episode flag |
|
Yes |
adloadtype | type of ad load:
|
|
Yes |
segB | custom segment for the clients granular reporting within a brand | Example: ChannelName | Optional |
segC | custom segment for the clients granular reporting within a brand | Example: PlayerName | Optional |
Example Content Object
var content_metadata_object = {
// SDK Metadata
type: 'content',
assetid: 'VID123-123456',
program: 'program name',
title: 'episode title',
length: '543', // length in seconds (String)
airdate: '19700101 00:00:00',
isfullepisode: 'y',
adloadtype: '2'
segB: 'ChannelName', // optional
segC: 'PlayerName', // 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' |
Yes |
assetid | unique ID assigned to Ad | custom (no Special Characters) |
Yes |
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.
Start the Measurement
Nielsen APIs calls are made by calling the function ggPM("event", parameter, ...) with "event" Parameter indicating the SDK API.
nSdkInstance.ggPM("event", parameter, ...);
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 interrupted/paused 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. |
Start the measurement by calling the "event" names "loadMetadata" followed by "setPlayheadPosition".
// START OF STREAM (main content)
nSdkInstance.ggPM("loadMetadata", contentMetadataObject);
// CONTENT plays
// pass playhead every second
nSdkInstance.ggPM("setPlayheadPosition", playheadPosition);
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);
Stop/Resume the Measurement for video Playback Interruptions
Handle Video Playback Interruption
The setPlayheadPostion event is used for handling playback interruption. To indicate that the video player is not playing (i.e. paused, buffering), stop passing the playhead position to the SDK. Once the Playback resumes , begin sending the playhead position again with the correct playhead value.
List of video Playback Interruptions
The following possible video Playback Interruptions must be handled:
- Player PAUSED
- Player BUFFERING
- Browser/Tab close
- Leaving the page to another destination
- Pressing the stop button
- Network Loss
Example for handling Playback Interruption: Browser/Tab close/Page Reload
window.addEventListener("beforeunload", function(event)
{
// Only inside an Ad indicate <stop> for the ad
nSdkInstance.ggPM("stop", playheadPosition);
// Indicate <end> for the content
nSdkInstance.ggPM("end", playheadPosition);
});
Note: additional code may be needed in order to support specific browser versions (e.g. older versions of Internet Explorer).
SDK Call Sequence
The sample event lifecycles can be used as a reference for identifying the order for calling events.
Content Playback Call Sequence
// START OF STREAM
nSdkInstance.ggPM("loadMetadata", contentMetadataObject);
// CONTENT plays
// pass playhead every second
//
nSdkInstance.ggPM("setPlayheadPosition", playheadPosition);
//
// END OF STREAM
nSdkInstance.ggPM("end", playheadPosition);
Ad Playback Call Sequence (Optional for DR)
// START OF Ad
nSdkInstance.ggPM("loadMetadata", adMetadataObject);
// Ad plays
// pass playhead every second
//
nSdkInstance.ggPM("setPlayheadPosition", playheadPosition);
// END OF Ad
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" or "end".
- For Ad Pods, events must be called for each individual Ad. Each Ad playhead position should begin at "0" when an 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.
Review SDK Integration Architecture Diagram
For Content Playback
For Ad Playback
Nielsen Opt-Out
The Browser SDK video measurement is working without cookies and other personal information. No user can be identified personally, therefore an opt-out functionality is not required. The Nielsen SDK video measurement is utilizing a cookieless domain.
In order to disclose Nielsen measurement privacy statement, please include the following items in your privacy policy:
- A notice that the player includes third party measurement software that allows users to contribute to market research with anonymous data.
- A link to the Nielsen Digital Measurement Privacy Policy located at https://global.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=en-ie (There is also a version in Irish available: https://global.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=ga )
Test your player by yourself
Guide
1. Run your player in the Browser, start a video
2. Open the Developer Network View in order to monitor network traffic
3. Filter the network traffic by "nmr" and confirm presence of SDK pings
Example of SDK ping
https://secure-ire.nmrodam.com/cgi-bin/gn?prd=dcr&ci=us-500207&ch=us-500207_c77_P&asn=defChnAsset&fp_id=&fp_cr_tm=&fp_acc_tm=&fp_emm_tm=&ve_id=&devmodel=&manuf=&sysname=&sysversion=&sessionId=zlmmxkq867zt4bpnumlyz6dpn9hyp1610980356&tl=Episode%201&prv=1&c6=vc%2Cc77&ca=us-500207_c77_VID5556674-123456&cg=TAMSample%20DK&c13=asid%2CP10DF14BA-937E-436D-99DF-ED39A0422387&c32=segA%2CNA&c33=segB%2CNA&c34=segC%2CNA&c15=apn%2C&plugv=&playerv=&sup=1&segment2=&segment1=&forward=0&ad=0&cr=4_00_99_V1_00000&c9=devid%2C&enc=true&c1=nuid%2C999&at=view&rt=video&c16=sdkv%2Cbj.6.0.0&c27=cln%2C0&crs=&lat=&lon=&c29=plid%2C16109803568088038&c30=bldv%2C6.0.0.563&st=dcr&c7=osgrp%2C&c8=devgrp%2C&c10=plt%2C&c40=adbid%2C&c14=osver%2CNA&c26=dmap%2C1&dd=&hrd=&wkd=&c35=adrsid%2C&c36=cref1%2C&c37=cref2%2C&c11=agg%2C1&c12=apv%2C&c51=adl%2C0&c52=noad%2C0&sd=170&devtypid=&pc=NA&c53=fef%2Cy&c54=oad%2C20200713%2010%3A22%3A00&c55=cref3%2C&c57=adldf%2C2&ai=VID5556674-123456&c3=st%2Cc&c64=starttm%2C1610980392&adid=VID5556674-123456&c58=isLive%2Cfalse&c59=sesid%2Cgezrb92q4i9b9jg7acxgn783gjw0a1610980365&c61=createtm%2C1610980392&c63=pipMode%2C&c68=bndlid%2C&nodeTM=&logTM=&c73=phtype%2C&c74=dvcnm%2C&c76=adbsnid%2C&c77=adsuprt%2C2&uoo=&evdata=&c71=ottflg%2C0&c72=otttyp%2Cnone&c44=progen%2C&davty=0&si=http%3A%2F%2Fnielsenonlinesupport.com%2Fdk%2Findex.htm&c66=mediaurl%2Cassets%252FRTVOD_C3%252Fprog_index.m3u8&c62=sendTime%2C1610980392&rnd=714644
Provide your app for certification
Once ready please send your web application to Nielsen local staff for certification.
Going Live
After the integration has been certified (but not prior that), disable debug logging by deleting {nol_sdkDebug: "DEBUG"} from Initialization API Call.
Note: before going live you have to inform Nielsen - this is necessary, because Nielsen team has to adjust internal configuration parameter to enable data collection. Without that notification no data will be collected and no data will be reported.