DCR Norway Audio Browser SDK: Difference between revisions

From Engineering Client Portal

 
Line 457: Line 457:
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.
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 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/no/en/optout.html.
* A link to the Nielsen Digital Measurement Privacy Policy at https://nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=en-no
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.
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 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/no/en/optout.html.''
''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://nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=en-no''


====Opt Back In====
====Opt Back In====

Latest revision as of 09:11, 4 August 2022

Engineering Portal / Digital / International DCR / DCR Norway Audio Browser SDK

Overview

The Nielsen SDK is one of multiple framework SDKs that Nielsen provides to enable measuring linear (live) and on-demand audio and video streaming using mobile devices, desktop browser, TV, 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 Content Ratings, Digital in TV Ratings (DCR & DTVR), Digital Ad Ratings (DAR). Nielsen SDKs are also equipped to measure static content and can track key life cycle events of pages like:

  • Site launch events and how long page is viewed
  • Time of viewing a sub section / page.

Prerequisites

To get started, an AppID is needed. The AppID is a unique ID assigned to the player/site/app. This will be provided upon starting the integration from Nielsen.

  apid: "XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" // eg. PDA7D5EE6-B1B8-XXXX-XXXX-2A788BCXXXCA

Configure SDK

There are two steps required for configuring the SDK:

  • Add Static Queue Snippet
  • Create SDK Instance

Static Queue Snippet

Add the following script tag to the website:

<script>
!function(t,n)
{
  t[n]=t[n]||
  {
    nlsQ:function(e,o,c,r,s,i)
    {
     return s=t.document,
     r=s.createElement("script"),
     r.async=1,
     r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
     i=s.getElementsByTagName("script")[0],
     i.parentNode.insertBefore(r,i),
     t[n][o]=t[n][o]||{g:c||{},
     ggPM:function(e,c,r,s,i){(t[n][o].q=t[n][o].q||[]).push([e,c,r,s,i])}},t[n][o]
    }
  }
}

(window,"NOLBUNDLE");

var nSdkInstance = NOLBUNDLE.nlsQ("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(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", {nol_sdkDebug: "DEBUG"});
</script>

Create Metadata Objects

There are two types of asset metadata:

  • content: identify content stream
  • 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.

Keys Description Values Required/Obligatory
type type of asset "content"
isAudio indicate measurement of audio ads or audio content "true"
assetid unique ID assigned to asset (64 character limit) custom
(no Special Characters)
program (string) name of program (254 character limit) custom
title (string) episode title (max 254 characters) custom
length length of content in seconds seconds ('0' for 24/7 Livestream if only one assetid is used for the whole stream. If reporting on program level, length of the program. )
airdate the airdate in the linear over-the-air broadcast (publication date).
This is required for both LIVE & VOD
Supported formats are:


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

MM-DD-YYYY

MM/DD/YYYY

scheduledEndDate the airdate when this particular asset ended in the linear over-the-air broadcast.
This is required for both LIVE & VOD. In the case of VOD, this will be the airdate + length.
This should be the same format as airdate
isfullepisode full episode flag "y"- full episode, "n"- non full episode
adloadtype type of ad load:

"1" Linear – matches over-the-air ad load

"2" Dynamic – Dynamic Ad Insertion (DAI)

"2" - DCR measures content with dynamic ads
stationType OTA station flag and/or OTA station type

"0" Custom station built per user

"1" OTA streaming station with the same adload

"2" OTA station with a different ad load

"3" Multicast eRadio or online station

"4" On Demand Audio(podcasting)

stationId (string) name of the channel custom
clientid

parent ID – value is automatically populated through provided App ID.
In order to override the brand configured to the App ID, pass parent
value here and the sub-brand ID associated to that brand in the subbrand
key (e.g. multiple brands in App)

provided by Nielsen

subbrand vcid/sub-brand ID – value is automatically populated through provided

App ID. In order to override the sub-brand configured to the App ID, value can
be passed here (e.g. multiple sub-brands in App). clientId does not need to be provided.

provided by Nielsen

progen (string) genre information (max 254 characters)

custom


Example Content Object

var content_metadata_object = {  
  // SDK
  type:     'content',
  isAudio:  'true',
  assetid:  'VID123-123456',
  program:  'program name',
  title:    'episode title',
  length:   '543',
  ...
}

Ad Metadata Object

The ad metadata should be passed for each individual ad.

Keys Description Values Required
type type of ad 'preroll', 'midroll', or 'postroll'
assetid unique ID assigned to ad custom

Example Ad Object

var adMetadataObject = 
{  
  assetid: 'AD-1',
  type:    'preroll'
};


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.

Avoid Carriage Return (CR) and/or Linefeeds (LF) in all fields (because of current data reporting as CSV)! Implementations has to filter out CR/LF with appropriate programming. It's also a good idea to check and validate entries from other systems (eg. CMS, player) before simply copy them to the variables in metadata.

Interrupt Scenarios

Pause Event

To indicate pause

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

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

var stopped = false;
function closePlayer() {
	if (stopped) {return;}
	stopped = true;
	if (inMidroll) {    // Only inside a midroll indicate <stop> for the ad
		nSdkInstance.ggPM('stop', playheadPositionMidroll);
	}
	nSdkInstance.ggPM('end', playheadPositionContent);    // Indicate <end> for the content
};
window.addEventListener("beforeunload", function (e) {
	closePlayer();   // call nielsensdk with end/stop
});
window.addEventListener("pagehide", function (e) {	// for iOS mobile "pagehide" recommended by apple
	closePlayer();   // call nielsensdk with end/stop
});

Note: User may need to add code to support specific browser versions (e.g. older versions of Internet Explorer or covering Safari on mobile browsers ... you may use "onpagehide" event as well).

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'
  • "on-demoand (or ad ): || current position in seconds (integer)
  • "Live: current UTC timestamp (seconds since January 1st 1970)

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


without Ads


Event Lifecycle without ads:


even browser no ads.png

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:


event browser.png

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


  • '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'.
  • after an 'end' in case there is a new content played, there is a need to have another 'loadmetadata' again.
  • For Ad, 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.
  • 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.

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://nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/?lang=en-no

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.

  1. 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");


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.