DCR Sweden Video Browser SDK: Difference between revisions

From Engineering Client Portal

m (→‎Privacy and Opt-Out: adding new opt-in/opt-out links shared by Zeljko)
 
(61 intermediate revisions by 3 users not shown)
Line 3: Line 3:


== Overview ==
== 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 Nielsen SDK is one of the multiple framework SDKs that Nielsen provides to enable measuring linear (live) and on-demand TV viewing using TVs, mobile devices, etc.
The Browser SDK (BSDK) is the framework for browser application developers to integrate Nielsen Measurement into their media players. It supports a variety of Nielsen Measurement Products like Digital in TV Ratings ([[DCR & DTVR|DTVR]]) and Digital Content Ratings ([[DCR & DTVR|DCR]]). Nielsen SDKs are also equipped to measure static content and can track key life cycle events.
The Browser SDK (BSDK) is the framework for browser application developers to integrate Nielsen Measurement into their media players. It supports a variety of Nielsen Measurement Products like Digital in TV Ratings ([[DCR & DTVR|DTVR]]) and Digital Content Ratings ([[DCR & DTVR|DCR]]). Nielsen SDKs are also equipped to measure static content and can track key life cycle events.


Line 26: Line 26:


=== Add Static Queue Snippet ===
=== Add Static Queue Snippet ===
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 seamlessly transition from directing to the queue to the SDK.
<br>
<br>


Line 42: Line 42:
     r=s.createElement("script"),
     r=s.createElement("script"),
     r.async=1,
     r.async=1,
     r.src=("http:"===t.location.protocol?"http:":"https:")+"//secure-sw.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
     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=s.getElementsByTagName("script")[0],
     i.parentNode.insertBefore(r,i),
     i.parentNode.insertBefore(r,i),
Line 54: Line 54:


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"
});
});


Line 67: Line 66:
==== Initialization API Call ====
==== Initialization API Call ====
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
NOLBUNDLE.nlsQ("<appid>", "<instanceName>",{nol_sdkDebug: "debug"});
NOLBUNDLE.nlsQ("<appid>", "<instanceName>",{nol_sdkDebug: "debug", hem_unknown: "924899b875ea6767....", enableFpid: "true"});
</syntaxhighlight>
</syntaxhighlight>
<br>
<br>
For creating an instance, pass the following values: (<code>nol_sdkDebug</code> is optional)
For creating an instance, pass the following values: (<code>nol_sdkDebug</code> is optional,<code>hem_unknown</code> is required if login feature enabled), <code>enableFpid</code> value is required to to set collection of first party ID to true/false.
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 81: Line 80:
| nol_sdkDebug || Enables Nielsen console logging if desired. || <syntaxhighlight lang="javascript">
| nol_sdkDebug || Enables Nielsen console logging if desired. || <syntaxhighlight lang="javascript">
{nol_sdkDebug: "debug"}  
{nol_sdkDebug: "debug"}  
</syntaxhighlight>
|-
|hem_unknown || Hashed email using SHA512. This email is used by the MMS reach model. (required if login feature) || <syntaxhighlight lang="javascript">
{hem_unknown: "924899b875ea6767ab790bd2f4852345fcfec5d203c49be8e8..."}
</syntaxhighlight>
|-
| enableFpid || true/false value is required to to set collection of first party ID.|| <syntaxhighlight lang="javascript">
{enableFpid: "true"} //alternative: false
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 91: Line 98:


var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance", {
var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance", {
     nol_sdkDebug: "debug"
     nol_sdkDebug: "debug",
    hem_unknown: "924899b875ea6767ab790bd2f4852345fcfec5d203c49be8e8...",
    enableFpid: "true"
});
});


Line 101: Line 110:
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.  
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:
There are two types of asset metadata:
*content: identify a video
*Content: identify a 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 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.
Metadata is 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.


==== Create Content Metadata ====
==== Create 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 entirety of an episode/clip, including when ads play.
<br>
<br>
Please see the [[Sweden_SDK_Metadata|Metadata link]] for the full list of content and ad metadata.
Please see the [[Sweden_SDK_Metadata|Metadata link]] for the complete list of content metadata.
<br/>
<br/><br>
<blockquote> program and title metadata values should be passed to SDK as UTF-8 strings. </blockquote>
 
{| class="wikitable"
|-
! Nielsen Key !! MMS Attribute Name, MMS Field Name !! Description !! Values !! Required
|-
| type ||  || type of asset || "content" || ✓
|-
| assetid || Content ID, mms_tid || unique ID assigned to an asset within the same media house. || For content on simulcast channels, this has a standard format: simulcast_channelnumber ('''Example''' for Channel TV4, the expected value is: simulcast_29).<br>
 
<small>A complete list of channel reference libraries with channel numbers is on the  [https://mms.se/?page_id=108 MMS homepage] tab "referensbandade kanaler".</small>


<small>For VoD, it does not need to follow the simulcast_channelnumber format.</small>
'''Note:''' Program and title metadata values should be passed to SDK as UTF-8 strings.
 
<small>Length limit: 20 characters. [https://engineeringportal.nielsen.com/docs/Special_Characters No special characters]</small>
|| ✓ <br>
 
|-
| length || Clip Length, ns_st_cl || length of content in seconds || Length of content in seconds.
* <small>for simulcast and 24/7 live stream, 86400</small>
* <small>for event-Live stream, the planned length</small>
* <small>for VoD, video length</small>
|| ✓
|-
| program || Program Name, ns_st_pr || program name || custom '''example:''' leif-och-billy || ✓
|-
| title || Episode Name, ns_st_ep || episode name || custom '''example:''' en-ny-tjej-i-byn || ✓
|}
 
===== Example Content Object =====
<syntaxhighlight lang="javascript">
var contentMetadataObject =
  type:          "content",
  assetid:        "unique_content_id",
  program:        "program name",
  title:          "episode title",
  length:        "length in seconds",
};
</syntaxhighlight>


==== Create Ad Metadata ====
==== Create Ad Metadata ====
The Ad Metadata (if applicable) should be passed for each individual ad.
The Ad Metadata (if applicable) should be passed for each individual ad.
<br>
<br>
Please see the [[Sweden_SDK_Metadata|Metadata link]] for the full list of content and ad metadata.<br>
Please see the [[Sweden_SDK_Metadata|Metadata link]] for the full list of ad metadata.<br>




Note: All metadata values should be passed as UTF-8 strings.
'''Note:''' All metadata values should be passed as UTF-8 strings.
{| class="wikitable"
|-
! Nielsen Key !! MMS Attribute Name, MMS Field Name !! Description !! Values !! Required
|-
| type || Ad Type, ns_st_ad || type of ad || "preroll", "midroll", "postroll", "ad" if specific ad type cannot be identified. || ✓
|-
| assetid || Film Code, mms_customadid || custom Ad ID || custom '''examples:''' S1MYME202B, 51TRER1001, H1KYLE3032, E1UMBR1001
|| ✓
|}


===== Example Ad Object =====
<syntaxhighlight lang="javascript">
var adMetadataObject =
  type:    "preroll",
  assetid: "unique_preroll_ad_id"
};
</syntaxhighlight>
<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>


=== Start the Measurement ===
=== Start the Measurement ===
Nielsen APIs calls are made by calling the function ggPM(event, parameter, ...) with "event" Parameter indicating the SDK API.
Nielsen APIs calls are made by calling the function ggPM("event", parameter, ...) with the "event" Parameter indicating the SDK API.
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
nSdkInstance.ggPM(event, parameter, ...);
nSdkInstance.ggPM("event", parameter, ...);
</syntaxhighlight>
</syntaxhighlight>


Line 196: Line 149:
|-
|-
| "setPlayheadPosition" || playhead position as integer<br/>
| "setPlayheadPosition" || playhead position as integer<br/>
<small>'''VOD:'''  current position in seconds <br/>
VOD: current position in seconds <br/>
'''Live:''' current Unix timestamp (seconds since Jan-1-1970 UTC) <br/>
Live: current Unix timestamp (seconds since 01-01-1970 UTC) <br/>
'''Note:''' "setPlayheadPosition" has to be called every second</small>
||
||
<small>Pass playhead position every second during playback</small>
Pass playhead position every second during playback
|-
|-
|-
|-
Line 206: Line 158:
|-
|-
| "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/>
<small>'''Example:''' At the end of the content stream, if the user switches to another piece of content when the browser is refreshed or closed.</small>
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 "loadMetadata" followed by "setPlayheadPosition".
Start the measurement by calling the "event" names "loadMetadata" followed by "setPlayheadPosition".




Line 327: Line 279:
* For Ad Pods, events must be called for each individual Ad. Each Ad playhead position should begin at ‘0’ when ad starts.
* 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.
* When content has resumed following an ad break, the playhead position update must continue where the previous content segment left off. The playhead position should be passed as a rounded number with no decimals.
</blockquote>
</blockquote>


Line 340: Line 292:


== Privacy and Opt-Out  ==
== Privacy and Opt-Out  ==
There are two primary methods for implementing user Opt-out preferences:
The site must provide a means for the user to opt-out of, or opt back into, Nielsen Measurement. Users can opt out if they 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.
# [[#User Opt Out|User Opt Out]] - Provide a link to the Nielsen Privacy Policy page when a User can make their selection
*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).
# [[#Initialization Opt Out|Initialization Opt Out]] - Global OptOut Parameter
*A link to the Nielsen Digital Measurement Privacy Policy at https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=sv (or for English: https://nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=en-se)
*We have two separate entities registered with the IAB TCF, Nielsen Marketing Cloud and Nielsen LLC.  The one that is relevant to Swedish measurement is Nielsen LLC (ID: 812) and not NMC. <br><br>


=== 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://sites.nielsen.com/priv/browser/se/sv/optout.html


On the Nielsen Digital Measurement Privacy Policy page, users can click on "Choices (Valmöjligheter)" to read more details about the measurement software. They can learn about their options with regard to Nielsen measurement and their choice to participate or not participate in Nielsen online measurement. The two choices are shown below.
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.
<br />
<br />
* Once users have '''opted out''' via this [https://priv.imrworldwide.com/priv/browser/cookie-policy-se-sv.html?optout=1 link], their browser cookies will contain the value '''TOTAL_OPTOUT'''. This will prevent a redirect to our data provider from occurring
* Once users have opted out via this [https://priv-policy.imrworldwide.com/priv/browser/cookie-policy.html?optout=1 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 [https://priv.imrworldwide.com/priv/browser/cookie-policy-reset-se-sv.html?optout=0 link].  When a user selects that link, their opt-out cookie will be deleted and they will be able to be measured moving forward.
* Users can opt back in via this [https://priv-policy.imrworldwide.com/priv/browser/cookie-policy.html?optout=0 link].  When a user selects that link, their opt-out cookie will be deleted and they will be able to be measured moving forward.
<br>
<br>
The following paragraph is a template for a Privacy Statement.
<blockquote>
The properties may feature Nielsen proprietary measurement software, allowing 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 concerning it, please see the Nielsen Digital Measurement Privacy Policy at https://nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=sv
</blockquote>
==== User Opt Back In ====
Once users have opted-out, they can choose to opt back into Nielsen Measurement at any time 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.


=== User Opt Back In ===
==== First Party ID (FPID)====
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.
- The broadcaster must enableFPID in the initialization settings which is set to <code>true</code> or <code>false</code> depending on user consent. This is to be set by the broadcaster when initializing our SDK.<br>


=== Required Privacy Links ===
- The <code>enableFpid</code> flag is needed to enable/disable FPID usage for the AppID. The default value for this flag is true. If this flag is changed from true to false, then the AppSDK should wipe out the stored FPID and use a blank value for FPID parameter in all the pings.<br>
The following paragraph is a template for a Privacy Statement which users must have access to the "About Nielsen Measurement" page and and "Your Choices" link in the Privacy Policy.
 
<blockquote>
- Generated FPID value is stored in the persistent memory until the application is uninstalled from a device or until FPID is wiped out or until it is expired.<br>
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://sites.nielsen.com/priv/browser/se/sv/optout.html
 
</blockquote>
- The default value for this parameter is 180 days. Once this timeout is reached, the FPID should be regenerated.<br>


==  Review the Reference Implementation for VoD and Live Streams ==


=== Initialization Opt Out ===
The Reference Implementation covers VoD and Live use cases.  
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.
It also covers DAI (Dynamic Ad Insertion) with preroll and post-roll Ads.


{| class="wikitable"
In order to start a live stream, select the checkbox "isLive" below the video player.
|-
! 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 ====


<syntaxhighlight lang="javascript">
Start the Reference Implementation for SE [http://nielsenonlinesupport.com/se/bsdk/index.htm sdkRefImplSE].
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {
<blockquote>
  nol_sdkDebug: "debug",
Review the Nielsen SDK Call Sequence below the Video Player.
  optout: "true"
</blockquote>
});
</syntaxhighlight>
=== Opt Out Overview ===
{| class="wikitable"
|-
! 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
|-
|}


== Test your player by yourself ==
== Test your player by yourself ==
=== Guide ===
=== Guide ===
1. Run your player in the Browser, start a video<br />
1. Run your player in the Browser, and start a video<br />
2. Open the Developer Network View in order to monitor network traffic<br />
2. Open the Developer Network View in order to monitor network traffic<br />
3. Filter the network traffic by "nmr" and confirm the presence of GN pings<br />
3. Filter the network traffic by "imr" and confirm the presence of GN pings<br />


=== Example of GN ping ===
=== Example of GN ping ===
<code><nowiki>https://secure-dmk.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</nowiki></code>
<code><nowiki>https://secure-sw.imrworldwide.com/cgi-bin/gn?prd=dcr&ci=se-910683&ch=se-910683_c01_P&asn=defChnAsset&fp_id=divasyzvortma4wwadx0nkwaccrzz1624870607&fp_cr_tm=1624870607291&fp_acc_tm=1630047884416&fp_emm_tm=1630047885495&ve_id=&sessionId=oorikaff6umkckzhx6fkfqgbu80m51630054501&tl=&prv=1&c6=vc,c01&ca=se-910683_c01_simulcast_1&cg=&c13=asid,P5DF5C88F-F43E-4917-97FD-DAEF3119E2CC&c32=segA,NA&c33=segB,NA&c34=segC,NA&c15=apn,&plugv=&playerv=&sup=1&segment2=&segment1=&forward=0&ad=0&cr=4_00_99_D108_00000&c9=devid,&enc=true&c1=nuid,OPTOUT&at=timer&rt=video&c16=sdkv,bj.6.0.0&c27=cln,12&crs=&lat=&lon=&c29=plid,16300545016407062&c30=bldv,6.0.0.602&st=dcr&c7=osgrp,&c8=devgrp,&c10=plt,&c40=adbid,&c14=osver,NA&c26=dmap,1&dd=&hrd=&wkd=&c35=adrsid,&c36=cref1,&c37=cref2,&c11=agg,1&c12=apv,&c51=adl,0&c52=noad,0&sd=86400&pc=NA&c53=fef,n&c54=oad,&c55=cref3,&c57=adldf,2&ai=simulcast_1&c3=st,c&c64=starttm,1630054569&adid=simulcast_1&c58=isLive,true&c59=sesid,qflwpxi57lzsfumtvobc0slztptzr1630054568&c61=createtm,1630054581&c63=pipMode,&ci_userid=&is_auto_play=no&pl_title=simulcast&is_prem=no&is_prog=&ad_origin=&adidx=&is_tpad=&ci_passthr=client_id%3De16d4ce1-0de4-4f76-b07b-4267065ef43a%2Cplayback_id%3D1630054566249%2Cproduct_family%3Dplay%2Cproduct_name%3Dsvtplay%2Cproduct_platform%3Dweb%2Cproduct_version%3D7.0.1727&c68=bndlid,&nodeTM=&logTM=&c73=phtype,&c74=dvcnm,&c76=adbsnid,&c77=adsuprt,2&uoo=&evdata=PL%3A1630054569%3A1630054570~ST%3A1630054582%3A1630054581&c71=ottflg,0&c72=otttyp,none&c44=progen,&davty=2&si=https%3A%2F%2Fsvtplaywebb-nielsen-tracking-test-branch.dev.borealis.svt.se%2Fvideo%2F32314179%2Fnyheter-direkt%2Fmiljopartiets-sommartal%3Fid%3D85RYwvP&c66=mediaurl,&sdd=retry,~~retryreason,~~devmodel,~~devtypid,~~sysname,~~sysversion,~~manuf,&cat_id=57114da6-dd95-4234-acc5-45b6540a024f&c62=sendTime,1630054581&rnd=185397</nowiki></code>


== Provide your app for certification ==
== Provide your app for certification ==

Latest revision as of 16:33, 28 August 2024

Engineering Portal / Digital / International DCR / DCR Sweden Video Browser SDK

Overview

The Nielsen SDK is one of the multiple framework SDKs that Nielsen provides to enable measuring linear (live) and on-demand TV viewing using TVs, mobile devices, etc. The Browser SDK (BSDK) is the framework for browser application developers to integrate Nielsen Measurement into their media players. It supports a variety of Nielsen Measurement Products like Digital in TV Ratings (DTVR) and Digital Content Ratings (DCR). Nielsen SDKs are also equipped to measure static content and can track key life cycle events.

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

Add Static Queue Snippet

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 seamlessly transition from directing to the queue to the SDK.

Add the following script tag to the website i.e. within the <head></head> tag :

<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"
});

</script>


Create SDK Instance

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

Initialization API Call

NOLBUNDLE.nlsQ("<appid>", "<instanceName>",{nol_sdkDebug: "debug", hem_unknown: "924899b875ea6767....", enableFpid: "true"});


For creating an instance, pass the following values: (nol_sdkDebug is optional,hem_unknown is required if login feature enabled), enableFpid value is required to to set collection of first party ID to true/false.

Parameter Description Values
appid Unique ID assigned to player/website "PXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
instanceName Name of SDK instance "any string value"
nol_sdkDebug Enables Nielsen console logging if desired.
{nol_sdkDebug: "debug"}
hem_unknown Hashed email using SHA512. This email is used by the MMS reach model. (required if login feature)
{hem_unknown: "924899b875ea6767ab790bd2f4852345fcfec5d203c49be8e8..."}
enableFpid true/false value is required to to set collection of first party ID.
{enableFpid: "true"} //alternative: false

When the initialization call is made, a unique static configuration file, <appid>.js, will be downloaded based on the appid and will be cached on the user’s browser.

Sample SDK Initialization Call

var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance", {
    nol_sdkDebug: "debug",
    hem_unknown: "924899b875ea6767ab790bd2f4852345fcfec5d203c49be8e8...",
    enableFpid: "true"
});

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

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

Create Content Metadata

Content metadata should remain constant throughout the entirety of an episode/clip, including when ads play.
Please see the Metadata link for the complete list of content metadata.

Note: Program and title metadata values should be passed to SDK as UTF-8 strings.

Create Ad Metadata

The Ad Metadata (if applicable) should be passed for each individual ad.
Please see the Metadata link for the full list of ad metadata.


Note: All metadata values should be passed as UTF-8 strings.

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 the "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
Live: current Unix timestamp (seconds since 01-01-1970 UTC)

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

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
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//  
//   pass playhead every second
//   
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);

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

Ad Playback Call Sequence

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

SDK Integration Architecture Diagram - Content

For Ad Playback

SDK Integration Architecture Diagram - Ad

Privacy and Opt-Out

The site must provide a means for the user to opt-out of, or opt back into, Nielsen Measurement. Users can opt out if they 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.


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, allowing 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 concerning it, please see the Nielsen Digital Measurement Privacy Policy at https://nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=sv

User Opt Back In

Once users have opted-out, they can choose to opt back into Nielsen Measurement at any time 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.

First Party ID (FPID)

- The broadcaster must enableFPID in the initialization settings which is set to true or false depending on user consent. This is to be set by the broadcaster when initializing our SDK.

- The enableFpid flag is needed to enable/disable FPID usage for the AppID. The default value for this flag is true. If this flag is changed from true to false, then the AppSDK should wipe out the stored FPID and use a blank value for FPID parameter in all the pings.

- Generated FPID value is stored in the persistent memory until the application is uninstalled from a device or until FPID is wiped out or until it is expired.

- The default value for this parameter is 180 days. Once this timeout is reached, the FPID should be regenerated.

Review the Reference Implementation for VoD and Live Streams

The Reference Implementation covers VoD and Live use cases. It also covers DAI (Dynamic Ad Insertion) with preroll and post-roll Ads.

In order to start a live stream, select the checkbox "isLive" below the video player.

Start the Reference Implementation for SE sdkRefImplSE.

Review the Nielsen SDK Call Sequence below the Video Player.

Test your player by yourself

Guide

1. Run your player in the Browser, and start a video
2. Open the Developer Network View in order to monitor network traffic
3. Filter the network traffic by "imr" and confirm the presence of GN pings

Example of GN ping

https://secure-sw.imrworldwide.com/cgi-bin/gn?prd=dcr&ci=se-910683&ch=se-910683_c01_P&asn=defChnAsset&fp_id=divasyzvortma4wwadx0nkwaccrzz1624870607&fp_cr_tm=1624870607291&fp_acc_tm=1630047884416&fp_emm_tm=1630047885495&ve_id=&sessionId=oorikaff6umkckzhx6fkfqgbu80m51630054501&tl=&prv=1&c6=vc,c01&ca=se-910683_c01_simulcast_1&cg=&c13=asid,P5DF5C88F-F43E-4917-97FD-DAEF3119E2CC&c32=segA,NA&c33=segB,NA&c34=segC,NA&c15=apn,&plugv=&playerv=&sup=1&segment2=&segment1=&forward=0&ad=0&cr=4_00_99_D108_00000&c9=devid,&enc=true&c1=nuid,OPTOUT&at=timer&rt=video&c16=sdkv,bj.6.0.0&c27=cln,12&crs=&lat=&lon=&c29=plid,16300545016407062&c30=bldv,6.0.0.602&st=dcr&c7=osgrp,&c8=devgrp,&c10=plt,&c40=adbid,&c14=osver,NA&c26=dmap,1&dd=&hrd=&wkd=&c35=adrsid,&c36=cref1,&c37=cref2,&c11=agg,1&c12=apv,&c51=adl,0&c52=noad,0&sd=86400&pc=NA&c53=fef,n&c54=oad,&c55=cref3,&c57=adldf,2&ai=simulcast_1&c3=st,c&c64=starttm,1630054569&adid=simulcast_1&c58=isLive,true&c59=sesid,qflwpxi57lzsfumtvobc0slztptzr1630054568&c61=createtm,1630054581&c63=pipMode,&ci_userid=&is_auto_play=no&pl_title=simulcast&is_prem=no&is_prog=&ad_origin=&adidx=&is_tpad=&ci_passthr=client_id%3De16d4ce1-0de4-4f76-b07b-4267065ef43a%2Cplayback_id%3D1630054566249%2Cproduct_family%3Dplay%2Cproduct_name%3Dsvtplay%2Cproduct_platform%3Dweb%2Cproduct_version%3D7.0.1727&c68=bndlid,&nodeTM=&logTM=&c73=phtype,&c74=dvcnm,&c76=adbsnid,&c77=adsuprt,2&uoo=&evdata=PL%3A1630054569%3A1630054570~ST%3A1630054582%3A1630054581&c71=ottflg,0&c72=otttyp,none&c44=progen,&davty=2&si=https%3A%2F%2Fsvtplaywebb-nielsen-tracking-test-branch.dev.borealis.svt.se%2Fvideo%2F32314179%2Fnyheter-direkt%2Fmiljopartiets-sommartal%3Fid%3D85RYwvP&c66=mediaurl,&sdd=retry,~~retryreason,~~devmodel,~~devtypid,~~sysname,~~sysversion,~~manuf,&cat_id=57114da6-dd95-4234-acc5-45b6540a024f&c62=sendTime,1630054581&rnd=185397

Provide your app for certification

Once ready please send your application to Nielsen local staff for certification.

Going Live

After the integration has been certified (but not prior to that), disable debug logging by deleting {nol_sdkDebug: "DEBUG"} from Initialization API Call.