DCR Video & Static Cloud API: Difference between revisions

From Engineering Client Portal

(sandbox)
 
(31 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}}  {{CurrentBreadcrumb}}
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{CurrentBreadcrumb}}
[[Category:Digital]]
[[Category:Digital]]


This guide shows you how to integrate the Nielsen Cloud API to enable Digital Content Ratings (DCR) measurement on your over-the-top (OTT) Apps.
This guide shows you how to integrate the Nielsen Cloud API to enable Digital Content Ratings (DCR), and fuel other measurement products on your over-the-top (OTT) Apps.
*For Roku Apps, please see [[DCR Video & Static Roku Cloud API]]
*For Roku Apps, please see [[DCR Video & Static Roku Cloud API]]
*For Mobile Apps, please see [[DCR Video & Static Mobile Cloud API]]
*For Mobile Apps, please see [[DCR Video & Static Mobile Cloud API]]
Line 18: Line 18:
====URL Structure====
====URL Structure====


The Cloud API Calls are HTTP GET Requests with the URL structure:
The Cloud API Calls are HTTPS GET Requests with the URL structure:


<syntaxhighlight lang="javascript">[endpoint]/[appid]/[sessionID]/a?b=[payload]</syntaxhighlight>
<syntaxhighlight lang="javascript">[endpoint]/[appid]/[sessionID]/a?b=[payload]</syntaxhighlight>
Line 33: Line 33:
There are endpoints for testing and production:
There are endpoints for testing and production:


*Testing: <code>https://sandbox-cloudapi.imrworldwide.com/nmapi/v2/</code>
*Testing: <code>https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/</code>
*Production: <code>https://cloudapi.imrworldwide.com/nmapi/v2/</code>
*Production: <code>https://cloudapi.imrworldwide.com/nmapi/v2/</code>


Line 42: Line 42:


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
https://sandbox-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=
https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=
{
{
   "devInfo": [deviceInfo],
   "devInfo": [deviceInfo],
Line 53: Line 53:
   "position": [playhead_position],
   "position": [playhead_position],
   "type": [asset type],
   "type": [asset type],
   "utc": [UTC]
   "utc": [Unix time in ms]
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 60: Line 60:
A unique Session ID must be created upon app launch and provided in the URL. This will allow measurement to occur for the entire duration that a user is within the app.
A unique Session ID must be created upon app launch and provided in the URL. This will allow measurement to occur for the entire duration that a user is within the app.


The session ID must be a GUID that is passed with every request and remain consistent throughout each individual session. You can use an existing ID, a random number, or date.now() as shown in the recommended sample code below:
A Session ID needs to be completely unique so it is recommended to use a version 4 UUID or another method of your choosing to guarantee there are no repeats.
 
<syntaxhighlight lang="javascript">sessionID = Date.now()+String(Math.random()*1000000 >> 0);</syntaxhighlight>


Upon exiting the app, the session will need to be terminated using the delete event. Sessions will automatically expire after 30 minutes of cloud inactivity.
Upon exiting the app, the session will need to be terminated using the delete event. Sessions will automatically expire after 30 minutes of cloud inactivity.
Line 69: Line 67:
Define the URL structure using your provided <code>[appid]</code> and a unique <code>[sessionID]</code>.
Define the URL structure using your provided <code>[appid]</code> and a unique <code>[sessionID]</code>.


<syntaxhighlight lang="javascript">https://sandbox-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=[payload]</syntaxhighlight>
<syntaxhighlight lang="javascript">https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=[payload]</syntaxhighlight>


===Configure Payload===
===Configure Payload===
Line 89: Line 87:
payload = {
payload = {
     "devInfo": {
     "devInfo": {
         "devId": "AD-ID",  
         "devId": "AD-ID",
        "hem_sha256": "55C06A30DAA5D5F382FDEB8C702EC57875CC9D91A7C78BB620053FD81DC4335C",
        "uid2": "tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=",
        "uid2_token": "7be25cf9-8c40-5cc2-871e-19bf41940288MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=uid_token=AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA&",
         "apn": "AppName",
         "apn": "AppName",
         "apv": "1.0",
         "apv": "1.0",
Line 136: Line 137:
|-
|-
| devId || unique ID to identify user (e.g. Advertising ID, Roku Device ID) || custom || Yes
| devId || unique ID to identify user (e.g. Advertising ID, Roku Device ID) || custom || Yes
|-
| hem_sha256 || SHA-256 hashed email Note: email normalization rules applied before hashing || custom || Yes
|-
| uid2 || Trade Desk Unified ID 2.0 This should be the unencrypted, non-tokenized UID2.0 in the clear || custom || Yes
|-
| uid2_token ||Trade Desk Unified ID 2.0 UID2 token || custom || Yes
|-
|-
| apn || app name || custom || Yes
| apn || app name || custom || Yes
Line 150: Line 157:
"devInfo": {
"devInfo": {
   "devId": "AD-ID",
   "devId": "AD-ID",
  "hem_sha256": "55C06A30DAA5D5F382FDEB8C702EC57875CC9D91A7C78BB620053FD81DC4335C",
  "uid2": "tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=",
  "uid2_token": "7be25cf9-8c40-5cc2-871e-19bf41940288MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=uid_token=AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA&",
   "apn": "AppName",
   "apn": "AppName",
   "apv": "1.0",
   "apv": "1.0",
Line 170: Line 180:
| type || type of asset || <code>"content"</code> || Yes
| type || type of asset || <code>"content"</code> || Yes
|-
|-
| assetid || unique ID assigned to asset || custom || Yes
| assetid || unique ID assigned to asset || custom <br>(no [[Special Characters]]) || Yes
|-
|-
| program ||name of program (25 character limit) || custom || Yes
| program ||name of program (25 character limit) || custom || Yes
Line 176: Line 186:
| title ||name of program (25 character limit) || custom || Yes
| title ||name of program (25 character limit) || custom || Yes
|-
|-
| length || length of content in seconds || <code>seconds</code> (86400 for live stream) || Yes
| length || length of content in seconds || <code>seconds</code> (0 for live stream) || Yes
|-
|-
| segB || custom segment B || custom ||  
| segB || custom segment B || custom || No
|-
|-
| segC || custom segment C || custom ||  
| segC || custom segment C || custom || No
|-
|-
| airdate || the airdate in the linear TV || YYYYMMDD HH24:MI:SS || Yes
| airdate || the airdate in the linear TV || YYYYMMDD HH24:MI:SS || Yes
Line 186: Line 196:
| isfullepisode || full episode flag || <code>"y"</code>- full episode, <code>"n"</code>- non full episode || Yes
| isfullepisode || full episode flag || <code>"y"</code>- full episode, <code>"n"</code>- non full episode || Yes
|-
|-
| crossId1 || standard episode ID || custom || Yes
| crossId1 || standard episode ID || custom || No
|-
|-
| crossId2 || content originator (only required for distributors) || Nielsen ||
| crossId2 || content originator (only required for distributors) || Nielsen || No
|-
|-
| adloadtype || type of ad load:
| adloadtype || type of ad load:
Line 202: Line 212:
|| <code>"1"</code> or <code>"0"</code> || Yes
|| <code>"1"</code> or <code>"0"</code> || Yes
|-
|-
| progen || Genre (required only for non-TV originated content). See [[DCR OTT Genre List]] for accepted values || <code>"CV"</code> for Comedy Variety || Required for non-TV originated content
| subbrand || sub brand override || Nielsen || No
|-
| progen || program genre abbreviation - see [[DCR OTT Genre List]] for accepted values || <code>"CV"</code> for Comedy Variety || Yes
|}
|}


Line 222: Line 234:
     "adloadtype": "2",
     "adloadtype": "2",
     "hasAds": "1",  
     "hasAds": "1",  
    "subbrand": "c05",
     "progen": "CV"
     "progen": "CV"
}</syntaxhighlight>
}</syntaxhighlight>
Line 257: Line 270:
! Event !! Description
! Event !! Description
|-
|-
| <code>"playhead"</code> || Playhead position in seconds. Must be passed as a whole number every 10 seconds. The final playhead position should also be sent before an asset has changed to properly capture full duration. Playhead is used to handle pause and scrubbing. When content is paused, stop passing playhead position.
| <code>"playhead"</code> || Playhead position in seconds, must be passed as a whole number every 10 seconds. The final playhead position should be sent before an asset has changed to properly capture full duration. When content is paused, stop passing playhead position until content is resumed. On playhead scrubbing, send current playhead position, followed by the playhead position the user scrubs to. For Live streams, you may use Unix Time (in seconds) as the playhead position. Note that ad playheads must also use Unix Time if Unix Time is used for content playheads.
|-
|-
| <code>"complete"</code> || Complete event must be sent when the content has completed full playback or if a user has initiated a Stop. Before calling the complete event, a final playhead update with the final position is required to be sent to receive full duration credit. Complete does not need to be called if a user transitions videos (e.g. channel change or selecting a new VOD asset) before the video completes.
| <code>"complete"</code> || The complete event must be sent when the content has completed full playback. Before calling the complete event, a final playhead update with the final position is required to be sent to receive full duration credit. For Live streams, a complete event must be sent at program boundaries.
|-
|-
| <code>"delete"</code> || The delete event should be sent when the application is exited and the viewing session is completed. After 30 minutes of inactivity, the session will expire automatically. All creditable duration will be summarized for all asset types when delete occurs (content and ads). Note that the delete event may not be feasible on certain platforms that do not offer the necessary callbacks to trigger this event.
| <code>"delete"</code> || The delete event is optional and can be sent when the viewing session is terminated (typically on App close). A new session ID must be generated after sending a delete event. Delete should not be sent on app interruptions or foreground/background events. All creditable duration will be summarized for all asset types when delete occurs (content and ads).
|}
|}


Line 274: Line 287:
| <code>"event"</code> || event type || <code>"playhead"</code>, <code>"complete"</code>, or <code>"delete"</code> || Yes
| <code>"event"</code> || event type || <code>"playhead"</code>, <code>"complete"</code>, or <code>"delete"</code> || Yes
|-
|-
| <code>"position"</code> || creditable position || playhead position in seconds or UTC timestamp in seconds for livestream || Yes
| <code>"position"</code> || playhead position in seconds or Unix time in seconds || <code>"300"</code> || Yes
|-
|-
| <code>"type"</code> || asset type || <code>"content"</code>, <code>"ad"</code> || Yes
| <code>"type"</code> || asset type || <code>"content"</code>, <code>"ad"</code> || Yes
Line 384: Line 397:
* Playhead position must start at 0 for each new asset, and be passed at least every 10 seconds.
* Playhead position must start at 0 for each new asset, and be passed at least every 10 seconds.
* Final postion must be sent at the end of content or an ad
* Final postion must be sent at the end of content or an ad
* Playheads should be sent in seconds only, not milliseconds


'''Playhead: Ads'''
'''Playhead: Ads'''
Line 417: Line 431:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// 1. Create Session ID
// 1. Create Session ID
sessionID = Date.now()+String(Math.random()*1000000 >> 0); // Must be GUID for each viewing session
sessionID = dfc7dc6a-66a7-4705-9fba-adaaf7e3d5e0 // Example sessionID created using a UUID Generator


// 2. Define URL Structure with App ID and Session ID
// 2. Define URL Structure with App ID and Session ID
sessionURL = https://sandbox-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=
sessionURL = https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=


// 3. Configure Payload
// 3. Configure Payload
Line 469: Line 483:
   // wait and send again
   // wait and send again
}
}
(new Image).src = sessionURL+encodeURI(JSON.stringify(payload));
(new Image).src = sessionURL+encodeURIComponent(JSON.stringify(payload));
</syntaxhighlight>
</syntaxhighlight>
To ensure that the GET request does not receive a CORS issue, make sure to use the IMAGE request in conjunction with the content-type "text/plain" so CORS preflight is not triggered, causing the request to be rejected.


==== Enable Debug Logging ====
==== Enable Debug Logging ====
Line 492: Line 508:
</syntaxhighlight>
</syntaxhighlight>


==== HTTP Response Code ====
==== HTTPS Response Code ====


Confirm request was completed by viewing HTTP response code.
Confirm request was completed by viewing HTTPS response code.


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
Line 501: Line 517:
</syntaxhighlight>
</syntaxhighlight>


You can reference the HTTP Response Code table when reviewing your requests:
You can reference the HTTPS Response Code table when reviewing your requests:


{| class="wikitable"
{| class="wikitable"
Line 515: Line 531:


== Opt-Out ==
== Opt-Out ==
Your app must provide a means for the user to Opt-Out, or Opt-In to Nielsen Measurement. This requirement can be fulfilled by checking the device OS for the user's setting of "Limit Ad Tracking" or similar option. If the device offers "Limit Ad Tracking" settings, you must set uoo=true or uoo=false depending on the user's privacy setting. Also, ensure that the devId is set to a blank value if the user elects to opt-out.
Your app must provide a means for the user to Opt-Out, or Opt-In to Nielsen Measurement. This requirement can be fulfilled by checking the device OS for the user's setting of "Limit Ad Tracking" or similar option. If the device offers "Limit Ad Tracking" settings, you should set <code>uoo=true</code> or <code>uoo=false</code> depending on the user's privacy setting. Also, ensure that the <code>devId</code> is set to a blank value if the user elects to opt-out.


If the device does not have OS-level "Do Not Track" settings, you can implement opt-out by creating an Opt-Out/Opt-In button, toggle switch, or slider within the app "Settings", or "About" section to allow the user selection. If you have the ability to render text within the Opt-Out screen, it is recommended to add the Privacy Information included below.
If the device does not have OS-level "Do Not Track" settings, you can implement opt-out by creating an Opt-Out/Opt-In button, toggle switch, or slider within the app "Settings", or "About" section to allow the user selection.


[[File:Nielsen Opt-Out.png|link=]]
[[File:Nielsen Opt-Out.png|link=]]
Line 536: Line 552:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
"devInfo": {
"devInfo": {
     "apn": "Roku Sample App",
     "apn": "Cloud API Sample App",
     "apv": "1",
     "apv": "1",
     "devId": "7be25cf9-8c40-5cc2-871e-19bf41940288",
     "devId": "7be25cf9-8c40-5cc2-871e-19bf41940288",
Line 547: Line 563:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
   "devInfo": {
   "devInfo": {
     "apn": "Roku Sample App",
     "apn": "Cloud API Sample App",
     "apv": "1",
     "apv": "1",
     "devId": "", //devId must be blank when a user elects to Opt-Out.
     "devId": "", //devId must be blank when a user elects to Opt-Out.
Line 555: Line 571:


===== Privacy Information Template To Include In Opt-Out Screen =====
===== Privacy Information Template To Include In Opt-Out Screen =====
Additionally, all applications must display the Nielsen privacy policy within their application, typically in the Settings/About screen of your application. The Nielsen privacy policy text is listed below.


<blockquote>
<blockquote>
Line 565: Line 584:
'''''YOUR CHOICES'''''
'''''YOUR CHOICES'''''


Nielsen believes that you should have a choice about whether to contribute to our research and insights. To opt out, or opt into Nielsen measurement please toggle your "Limit Ad Tracking" (or similar setting) on your device. If you have this app on more than one device, you will need to opt out of this app on each device. To learn more about our digital measurement products and your choices in regard to them, please visit http://www.nielsen.com/digitalprivacy.
Nielsen believes that you should have a choice about whether to contribute to our research and insights. To opt out or opt in to Nielsen measurement, please toggle your "Limit Ad Tracking" (or similar setting) on your device, or make the appropriate selection within the application's settings. If you have this app on more than one device, you will need to opt out of this app on each device. To learn more about our digital measurement products and your choices in regard to them, please visit https://www.nielsen.com/digitalprivacy.
 
'''''Disclosure Template'''''
 
Additionally, you must update the App description information from the App Distribution Store with the Nielsen Measurement disclosure below:


This app features Nielsen's proprietary measurement software which will allow you to contribute to market research, like Nielsen's TV Ratings. Please see http://www.nielsen.com/digitalprivacy for more information.
</blockquote>
</blockquote>


Line 609: Line 623:
*Check to see that each of the Cloud API GET requests are properly encoded
*Check to see that each of the Cloud API GET requests are properly encoded


==== HTTP Response ====
==== HTTPS Response ====
*Make sure that each of the Cloud API Get requests are received by the Nielsen Cloud API properly through use of the HTTP Response Code outputs enabled in console.
*Make sure that each of the Cloud API Get requests are received by the Nielsen Cloud API properly through use of the HTTPS Response Code outputs enabled in console.


==== Opt-Out ====
==== Opt-Out ====
Line 622: Line 636:
'''Change Endpoint:''' You will need to update to the production endpoint:
'''Change Endpoint:''' You will need to update to the production endpoint:


*Testing: <code>https://sandbox-cloudapi.imrworldwide.com/nmapi/v2/</code>
*Testing: <code>https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/</code>
*Production: <code>https://cloudapi.imrworldwide.com/nmapi/v2/</code>
*Production: <code>https://cloudapi.imrworldwide.com/nmapi/v2/</code>



Latest revision as of 16:59, 11 May 2023

Engineering Portal / Digital / DCR Video & Static Cloud API

This guide shows you how to integrate the Nielsen Cloud API to enable Digital Content Ratings (DCR), and fuel other measurement products on your over-the-top (OTT) Apps.

Prerequisites

To get started, you will need a Nielsen App ID. The App ID is a unique ID assigned to your app. This will be provided to you upon starting the integration.

XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Integration

We will cover the steps for constructing the Cloud API Calls.

Request Overview

URL Structure

The Cloud API Calls are HTTPS GET Requests with the URL structure:

[endpoint]/[appid]/[sessionID]/a?b=[payload]

The URL includes the following components:

  • [endpoint]: location of data collection environment
  • [appid]: provided App ID
  • [sessionID]: unique value for each user session
  • [payload]: metadata and events

Endpoint

There are endpoints for testing and production:

During testing, all calls should be pointed to the testing endpoint. We will review the update to the production endpoint during the Go Live section of this guide.

URL Example

As you move through the integration steps, you can reference the below URL structure with the expanded payload:

https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=
{
  "devInfo": [deviceInfo],
  "metadata": {
    "static": [static_metadata],
    "content": [content_metadata],
    "ad": [ad metadata]
  },
  "event": [event],
  "position": [playhead_position],
  "type": [asset type],
  "utc": [Unix time in ms]
}

Create Session ID

A unique Session ID must be created upon app launch and provided in the URL. This will allow measurement to occur for the entire duration that a user is within the app.

A Session ID needs to be completely unique so it is recommended to use a version 4 UUID or another method of your choosing to guarantee there are no repeats.

Upon exiting the app, the session will need to be terminated using the delete event. Sessions will automatically expire after 30 minutes of cloud inactivity.

Define URL Structure

Define the URL structure using your provided [appid] and a unique [sessionID].

https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=[payload]

Configure Payload

All Cloud API requests must contain the following payload data:

  • devInfo: device and app info
  • metadata: asset metadata
  • event metadata: type of event

The payload can be passed through key-values using the Nielsen reserved keys. The specific keys and descriptions are highlighted in the tables included in this section.

Payload Example

The example below should be referenced when following the steps for configuring the request payload.

// 3.1 Configure Payload: devInfo 
payload = {
    "devInfo": {
        "devId": "AD-ID",
        "hem_sha256": "55C06A30DAA5D5F382FDEB8C702EC57875CC9D91A7C78BB620053FD81DC4335C",
        "uid2": "tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=",
        "uid2_token": "7be25cf9-8c40-5cc2-871e-19bf41940288MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=uid_token=AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA&",
        "apn": "AppName",
        "apv": "1.0",
        "uoo": "false"
    },
    
    // 3.2 Configure Payload: metadata
    "metadata": {
        "static": {}, // object for measuring static content
        "content": { // object for measuring video content
            "type": "content", // "content" for video
            "assetid": "VIDEO-ID123", // unique ID for video
            "isfullepisode": "y", // full episode flag
            "program": "Program Name", // program name
            "title": "Episode Title S3 - EP1", // episode name
            "length": "1800", // content duration in seconds
            "segB": "Custom Segment B", // custom segment
            "segC": "Custom Segment C", // custom segment
            "crossId1": "Standard Episode ID", // episode ID
            "crossId2": "Content Originator ID", // content orginator (required for distributors)
            "airdate": "20161013 20:00:00", // airdate
            "adloadtype": "2" //ad load flag
            "hasAds": "1", // content contains ads = 1 / no ads = 0
            "progen": "CV" // program genre abbreviation
        },
        "ad": {
            "type": "preroll", // type of ad
            "assetid": "AD-ID123" // unique ID for ad
        }
    },
    
    // 3.3 Configure Payload: events
    "event": "playhead", //event name
    "position": "300", // position in seconds
    "type": "content", //"content" or "ad"
    "utc": "1456448742000" //unix timestamp in milliseconds 
}
Configure Payload: devInfo

An object "devInfo" will need to be created to capture App and Device information.

Keys Description Values Required
devId unique ID to identify user (e.g. Advertising ID, Roku Device ID) custom Yes
hem_sha256 SHA-256 hashed email Note: email normalization rules applied before hashing custom Yes
uid2 Trade Desk Unified ID 2.0 This should be the unencrypted, non-tokenized UID2.0 in the clear custom Yes
uid2_token Trade Desk Unified ID 2.0 UID2 token custom Yes
apn app name custom Yes
apv app build version custom Yes
uoo device opt-out status "true" or "false" Yes

Example devInfo Object

// create devInfo object
"devInfo": {
  "devId": "AD-ID",
  "hem_sha256": "55C06A30DAA5D5F382FDEB8C702EC57875CC9D91A7C78BB620053FD81DC4335C",
  "uid2": "tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=",
  "uid2_token": "7be25cf9-8c40-5cc2-871e-19bf41940288MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=uid_token=AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA&",
  "apn": "AppName",
  "apv": "1.0",
  "uoo": "false"
},

3.2 Configure Payload: metadata

Asset metadata can be passed through "metadata". There are two asset types: "content" for video and "ad" for ads. The metadata received for each asset is used for classification and reporting.

You will need to set up "metadata" objects for "content" and "ad" 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
type type of asset "content" Yes
assetid unique ID assigned to asset custom
(no Special Characters)
Yes
program name of program (25 character limit) custom Yes
title name of program (25 character limit) custom Yes
length length of content in seconds seconds (0 for live stream) Yes
segB custom segment B custom No
segC custom segment C custom No
airdate the airdate in the linear TV YYYYMMDD HH24:MI:SS Yes
isfullepisode full episode flag "y"- full episode, "n"- non full episode Yes
crossId1 standard episode ID custom No
crossId2 content originator (only required for distributors) Nielsen No
adloadtype type of ad load:

"1" Linear – matches TV ad load

"2" Dynamic – Dynamic Ad Insertion (DAI)

"2" - DCR measures content with dynamic ads Yes
hasAds ads indicator

"1": ads included

"0": ads not included

"1" or "0" Yes
subbrand sub brand override Nielsen No
progen program genre abbreviation - see DCR OTT Genre List for accepted values "CV" for Comedy Variety Yes


Example Content Object

// create content object
"content": {
    "type": "content",
    "assetid": "VIDEO-ID123",
    "isfullepisode": "y",
    "program": "Program Name",
    "title": "Episode Title S3 - EP1",
    "length": "1800",
    "segB": "Custom Segment B",
    "segC": "Custom Segment C",
    "crossId1": "Standard Episode ID",
    "crossId2": "Content Originator ID",
    "airdate": "20161013 20:00:00",
    "adloadtype": "2",
    "hasAds": "1", 
    "subbrand": "c05",
    "progen": "CV"
}
Ad Metadata

The ad metadata should be passed for each individual ad.

Keys Description Values Required
type type of ad "preroll", "midroll", or "postroll" Yes
assetid unique ID assigned to ad custom Yes
Example Ad Object
// create ad object
"ad": {
  "type": "preroll",
  "assetid": "AD-ID123"
}

Configure Payload: Events

The last part of the payload is for enabling events so content is measured correctly when viewed. The events and required parameters are included below.

Event Types

The available events are:

Event Description
"playhead" Playhead position in seconds, must be passed as a whole number every 10 seconds. The final playhead position should be sent before an asset has changed to properly capture full duration. When content is paused, stop passing playhead position until content is resumed. On playhead scrubbing, send current playhead position, followed by the playhead position the user scrubs to. For Live streams, you may use Unix Time (in seconds) as the playhead position. Note that ad playheads must also use Unix Time if Unix Time is used for content playheads.
"complete" The complete event must be sent when the content has completed full playback. Before calling the complete event, a final playhead update with the final position is required to be sent to receive full duration credit. For Live streams, a complete event must be sent at program boundaries.
"delete" The delete event is optional and can be sent when the viewing session is terminated (typically on App close). A new session ID must be generated after sending a delete event. Delete should not be sent on app interruptions or foreground/background events. All creditable duration will be summarized for all asset types when delete occurs (content and ads).
Event Parameters

The following parameters need to be passed when calling events:

Parameter Description Value Required
"event" event type "playhead", "complete", or "delete" Yes
"position" playhead position in seconds or Unix time in seconds "300" Yes
"type" asset type "content", "ad" Yes
"utc" Unix timestamp in milliseconds. Must be passed every 10 seconds. "1472760000000" Yes
Example Event

You can call events by passing values in the required parameters:

"devInfo": [deviceInfo],
  "metadata": {
    "static": [static metadata],
    "content": [content metadata],
    "ad": [ad metadata]
  },
  // Event Parameters
  "event": [event], // event name
  "position": [playheadPosition], //position in seconds
  "type": [asset type], // values are "content" or "ad"
  "utc": "1472760000000" //unix timestamp in milliseconds
}

Note: The full payload including "devInfo" and "metadata" must be populated in each event request.

Sample Event Lifecycle

The sample event lifecycle can be used as a reference for identifying the order for calling events and values to pass.

// Start of Session: session ID created when App is opened

// Preroll
Ad Playhead {"event": "playhead", "position": "0", "type": "ad", "utc": "1472760000000"} 
 
// Content
Content Playhead {"event": "playhead", "position": "0", "type": "content", "utc": "1472760000000"} 

// Midroll
Midroll Playhead {"event": "playhead", "position": "0", "type": "ad", "utc": "1472760000000"} 

// Content resumes at 15 minutes
Content Playhead {"event": "playhead", "position": "900", "type": "content", "utc": "1472760000000"} 

// Content completes at 30 minutes
Complete {"event": "complete", "position": "1800", "type": "content", "utc": "1472760000000"} 
 
// Postroll
Ad Playhead {"event": "playhead", "position": "0", "type": "ad", "utc": "1472760000000"} 

//End of Session: The delete event should be called when the App is exited. The values for position and type not required to be passed.
Delete { "event": "delete", "position": "", "type": "", "utc": "1472760000000"}


Sample Event Lifecycle - Detailed Storyline This detailed event sequence provides additional insight for the correct events to call when handling certain playback scenarios.

// SESSION STARTS
// Start of Session: session ID created when App is opened

// PREROLL
// Preroll Start - Start each Ad with a position of "0", resetting to '0' for each Ad, and Ad break.
Ad Playhead {"event": "playhead", "position": "0", "type": "ad", "utc": "1472760000000"} 

// Preroll Stop - End each Ad with the final position of the Ad.
Ad Playhead {"event": "playhead", "position": "15", "type": "ad", "utc": "1472761500000"}
 
// CONTENT 
// Content Start - Start new content streams with a position of "0" incrementing the position every 10 seconds.
Content Playhead {"event": "playhead", "position": "0", "type": "content", "utc": "1472761500000"} 

// Content Stop Before Ad Break - Send a playhead update including the current content positon before an Ad break.
Content Playhead {"event": "playhead", "position": "299", "type": "content", "utc": "1472787400000"}

// MIDROLL
// Midroll Start - Start each Ad with a position of "0", resetting to '0' for each Ad, and Ad break.
Midroll Playhead {"event": "playhead", "position": "0", "type": "ad", "utc": "1472787500000"} 

// Midroll Stop - End each Ad with the final position of the Ad.
Ad Playhead {"event": "playhead", "position": "60", "type": "ad", "utc": "1472793500000"}

// CONTENT
// Content resumes at 5 minutes - Send playhead update with the current resumed position, and begin incrimenting the positon every 10 seconds.
Content Playhead {"event": "playhead", "position": "300", "type": "content", "utc": "1472799500000"} 

// Content completes at 10:12 - Make sure to send in the playhead event with the final content position before sending the complete event.
Final Content Playhead {"event": "playhead", "position": "612", "type": "content", "utc": "1472830700000"} 

Complete {"event": "complete", "position": "612", "type": "content", "utc": "1472830800000"} 

// POSTROLL
// Postroll Start - Start each Ad with a position of "0", resetting to '0' for each Ad, and Ad break.
Ad Playhead {"event": "playhead", "position": "0", "type": "ad", "utc": "1472830900000"} 

// Postroll Stop - End each Ad with the final position of the Ad.
Ad Playhead {"event": "playhead", "position": "45", "type": "ad", "utc": "1472835300000"}

// SESSION ENDS

//End of Session: The delete event should be called when the App is exited. The values for position and type not required to be passed.
Delete { "event": "delete", "position": "", "type": "", "utc": "1472835400000"}


Handling Playhead

Calling "playhead" is critical for accurate duration crediting. You can reference the below guidance to determine the correct playhead position to pass depending on the playback scenario.

Playhead: General

  • Playhead position must start at 0 for each new asset, and be passed at least every 10 seconds.
  • Final postion must be sent at the end of content or an ad
  • Playheads should be sent in seconds only, not milliseconds

Playhead: Ads

  • The final position must be sent when switching from content to ad, or ad to content.
  • Each ad playhead position should be 0 at ad start.
  • For Ad Pods, playhead must be called, and reset to 0 for each individual ad.
  • The last content position before an Ad should be sent before switching to Ads.
  • When content has resumed following an ad break, the playhead position update must continue where the previous content segment left off.

Playhead: User Actions

  • Upon user scrubbing, the current position must be sent before a user scrubs, and the new position should be sent where the user lands, and begin sending in the 10 second updates thereafter.
  • On pause, send the current position and then discontinue sending playhead event updates.
  • If a user exits a stream early, the last current position must be sent in a playhead update to receive accurate duration.
Interruption Scenarios

As part of configuring events, you will need to handle all possible interruption scenarios such as:

  • Wi-Fi OFF / ON
  • App going Background / Foreground (Video players only, not for Audio players)
  • App Crash or Exit

When playback is interrupted, the app needs to send delete immediately.

Once playback resumes, a new session will need to be created with a unique session ID. All of the required metadata and events will need to be sent.

Note: The session will automatically timeout after 30 minutes of inactivity.

Example Request

Now that we walked through the Cloud API integration steps, your requests should have the following components: Session ID, App ID, and Payload. You can reference the example below when your reviewing your integration.

// 1. Create Session ID
sessionID = dfc7dc6a-66a7-4705-9fba-adaaf7e3d5e0  // Example sessionID created using a UUID Generator

// 2. Define URL Structure with App ID and Session ID
sessionURL = https://sandbox2-cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=

// 3. Configure Payload
// 3.1 Configure Payload: devInfo 
payload = {
 "devInfo": {
   "devId": "AD-ID", 
   "apn": "AppName",
   "apv": "1.0",
   "uoo": "false"
  },
  
  // 3.2 Configure Payload: metadata
  "metadata": {
    "static": {}, // object for measuring static content
    "content": { // object for measuring video content
      "type": "content", // "content" for video
      "assetid": "VIDEO-ID123", // unique ID for video
      "isfullepisode": "y", // full episode flag
      "program": "Program Name", // program name
      "title": "Episode Title S3 - EP1", // episode name
      "length": "1800", // content duration in seconds
      "segB": "Custom Segment B", // custom segment
      "segC": "Custom Segment C", // custom segment
      "crossId1": "Standard Episode ID", // episode ID
      "crossId2": "Content Originator ID", // content orginator (required for distributors)
      "airdate": "20161013 20:00:00", // airdate
      "adloadtype": "2", // ad load flag
      "hasAds": "1", // content contains ads = 1 / no ads = 0
      "progen": "CV" // program genre abbreviation
    },
    "ad": {
      "type": "preroll", // type of ad
      "assetid": "AD-ID123" // unique ID for ad
    }
  },
    
  // 3.3 Configure Payload: events
  "event": "playhead", //event name
  "position": "300", // position in seconds
  "type": "content", //"content" or "ad"
  "utc": "1456448742000" //unix timestamp in milliseconds 
}

// Append payload to URL
var image = new Image()
image.onerror = function() {
  // wait and send again
}
(new Image).src = sessionURL+encodeURIComponent(JSON.stringify(payload));

To ensure that the GET request does not receive a CORS issue, make sure to use the IMAGE request in conjunction with the content-type "text/plain" so CORS preflight is not triggered, causing the request to be rejected.

Enable Debug Logging

Now that you have set up the Cloud API requests, you can enable debug logging to validate your integration. Enabling debug logging is required for Nielsen certification.

GET Request

Display GET Request to console using a name to identify each event (e.g. playhead).

console.log("Event", image);

Payload

Output payload to identify required metadata and events.

console.log("Event Payload", payload);

HTTPS Response Code

Confirm request was completed by viewing HTTPS response code.

code = msg.GetResponseCode();
console.log("Response Code", code);

You can reference the HTTPS Response Code table when reviewing your requests:

Status Code Status Text Description
200 OK request received
403 Forbidden invalid App ID
404 Not Found JSON issue

Opt-Out

Your app must provide a means for the user to Opt-Out, or Opt-In to Nielsen Measurement. This requirement can be fulfilled by checking the device OS for the user's setting of "Limit Ad Tracking" or similar option. If the device offers "Limit Ad Tracking" settings, you should set uoo=true or uoo=false depending on the user's privacy setting. Also, ensure that the devId is set to a blank value if the user elects to opt-out.

If the device does not have OS-level "Do Not Track" settings, you can implement opt-out by creating an Opt-Out/Opt-In button, toggle switch, or slider within the app "Settings", or "About" section to allow the user selection.

Nielsen Opt-Out.png

You will need to store the User Opt-Out (uoo) status, so that it can be retrieved and populated in the "devInfo" metadata which will be sent in every Cloud API event (playhead, complete, & delete).

uoo Key Description Values
uoo Device is Opted-In to Nielsen Measurement (Recommended Default Setting) "false"
uoo Device is Opted-Out of Nielsen Measurement "true"
devInfo Opt-In JSON Payload Example
"devInfo": {
    "apn": "Cloud API Sample App",
    "apv": "1",
    "devId": "7be25cf9-8c40-5cc2-871e-19bf41940288",
    "uoo": "false"
  },
devInfo Opt-Out JSON Payload Example
  "devInfo": {
    "apn": "Cloud API Sample App",
    "apv": "1",
    "devId": "", //devId must be blank when a user elects to Opt-Out.
    "uoo": "true"
  },
Privacy Information Template To Include In Opt-Out Screen

Additionally, all applications must display the Nielsen privacy policy within their application, typically in the Settings/About screen of your application. The Nielsen privacy policy text is listed below.

ABOUT NIELSEN MEASUREMENT

Television and the way we watch it have come a long way since Nielsen began measuring TV audiences in 1950. Today, the ability to watch our favorite shows at any time and on multiple devices amplifies the need for exceptionally adept and flexible audience measurement capabilities.

Consumers are changing with the times, and the same goes for us. As technology continues to evolve and media companies try new ways to attract viewers, understanding what consumers are watching — and what they're watching on — is more important than ever. Today, viewing video is a personal and mobile experience — anytime and anywhere. Our capabilities provide relevant metrics that are necessary to inform successful marketing and programming and drive continued growth. As a global information and measurement leader, we are committed to protecting the privacy and security of the data we collect, process and use. While our digital measurement products are not used to identify you in any way, they help us and our clients measure and analyze how consumers engage with media across online, mobile and emerging technologies, and offer insights into consumer behavior.

YOUR CHOICES

Nielsen believes that you should have a choice about whether to contribute to our research and insights. To opt out or opt in to Nielsen measurement, please toggle your "Limit Ad Tracking" (or similar setting) on your device, or make the appropriate selection within the application's settings. If you have this app on more than one device, you will need to opt out of this app on each device. To learn more about our digital measurement products and your choices in regard to them, please visit https://www.nielsen.com/digitalprivacy.

Testing

Before providing an app build to Nielsen for testing, it is important to run validation checks once you have enabled debug logging.

Payload Validation

Ensure that all of the required payload data is populating while testing several videos. The following areas are critical to measurement:

  • devInfo
  • Asset metadata for both content, and ads
  • Events
  • Opt-Out status

Player Events

Review event calls:

playhead

  • Playhead position updates every 10 seconds starting at position '0' for each new asset.
  • Final playhead position is sent on content, or ad before switching between assets.
  • Content metadata remains constant throughout an episode, or clip play.
  • Ad metadata is populated appropriately for each individual ad.
  • Playhead position update resumes for content after an ad break, and resets to 0 for each individual ad.
  • For scrubbing, last current position should be sent while scrubbing occurs, and the new position should also be sent where the user scrubs to.
  • Exiting a stream early should execute the last current position in a playhead update to receive accurate duration.
  • Upon pause, the current position should be sent, and playhead updates should stop incrementing until resume play occurs.

complete

  • Check that the complete event executes upon content complete after the final playhead update is sent
  • Do not execute the complete event for ads

delete

  • Check to see that the delete event occurs upon app exit, if the platform has the necessary exit callback events.

GET Request Format

  • Ensure that the event payloads are formatted in JSON
  • Check to see that each of the Cloud API GET requests are properly encoded

HTTPS Response

  • Make sure that each of the Cloud API Get requests are received by the Nielsen Cloud API properly through use of the HTTPS Response Code outputs enabled in console.

Opt-Out

  • Test the "uoo" key gets populated accurately for both Opt-In and Opt-Out selections by validating the Cloud API events called after the user Opt-Out/Opt-In selection.
  • Test that the devId field is populated with a blank value if a user has elected to Opt-Out. For example: "devId": "",
  • If the device supports "Limit Ad Tracking" or has device "Opt-Out" settings, test that uoo=true, and that devId is set to a blank value if enabled in the device settings.

Go Live

After your integration has been certified, you will need to: Change Endpoint and Disable Logging.

Change Endpoint: You will need to update to the production endpoint:

Your production URL structure should now be: https://cloudapi.imrworldwide.com/nmapi/v2/[appid]/[sessionID]/a?b=[payload]

Disable Logging: You can now disable debug logging