Difference between revisions of "Simplified SDK API"

From Engineering Client Portal

 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}}  {{CurrentBreadcrumb}}
 
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}}  {{CurrentBreadcrumb}}
 
[[Category:Digital]]
 
[[Category:Digital]]
 +
__NOTOC__
  
== Overview ==
+
== Introduction ==
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.
+
This document outlines the features of the new Simplified Nielsen SDK, which is available for use within your APP or online video site, which simplifies the integration of Nielsen measurement for Digital Content Ratings or DTVR. You are only required to execute one of 4 events. Tell the SDK if you want to track 'content', an 'ad', or a 'static' page load. If an event is sent out of sequence, this new API will put it in the correct order for processingAll of the Standard SDK calls can be replaced with one API call, and one dictionary object, where any value could be another complex dictionary object.<br/>
The App SDK is the framework for mobile application developers to integrate Nielsen Measurement into their media player applications. It supports a variety of Nielsen Measurement Products like Digital in TV Ratings, Digital Content Ratings ([[DCR & DTVR]]), [[Digital Ad Ratings]] (DAR), [[Digital Audio]]. Nielsen SDKs are also equipped to measure static content and can track key life cycle events of an application like:
+
<b>NOTE:</b> use of simplified API is not recommended for BrowserSDK implementations at this time.
*Application launch events and how long app was running
+
<br/><br/>
*Time of viewing a sub section / page in the application.
+
== Implementation Guides ==
 
 
== Prerequisites ==
 
To start using the App SDK, the following details are required:
 
* '''App ID (appid):''' Unique ID assigned to the player/site and configured by product.
 
* '''sfcode:''' Unique identifier for the environment that the SDK should point to.
 
* '''Nielsen SDK:''' The Nielsen SDK package contains a variety of sample players for your reference.
 
If you do not have any of these prerequisites or if you have any questions, please contact our SDK sales support team.
 
Refer to [[Digital Measurement Onboarding]] guide for information on how to get a Nielsen App SDK and appid.
 
 
 
== Simplified SDK API ==
 
As part of making the SDK more user friendly and reduce the number of app integration touch points, Nielsen has designed a simple interface to pass metadata to the sdk while reducing the number of API calls.  The new <code> trackevent() </code> API has been implemented as a wrapper for the existing SDK and will be responsible for handling new API calls, performing validation, and translation of new API calls to the existing Nielsen App SDK API methodsApplications which are already integrated with the existing SDK API, are unaffected by this new API.
 
[[File:SimplifiedAPI_vs_StandardAPI.png|icon]]
 
Existing API has a number of methods used for reporting player and application state changes to the SDK. Order of calls is important for the SDK in the existing API. In the new enhanced API all these calls will be replaced with one API call that will get one dictionary object with many key-value pairs, where any value could be another complex dictionary object. All the data provided in the existing API in separate calls will be provided in one single call. SDK will analyse the data received in the dictionary object, compare it with the data received previously and generate a sequence of calls for the existing API.
 
 
 
[[File:Co-Existance.jpg|center|700px]]
 
''For iOS SDK framework package will contain 2 public header files. One header file will contain old SDK interface and will be used by existing clients (NielsenAppApi.h). New API will be defined in a new public header file (NielsenEventTracker.h).''
 
 
 
''For Android, a new wrapper class for AppSdk will be introduced (AppSdkTrackEvent). This class will be responsible for handling and translating new API calls into calls of the existing Nielsen App SDK API methods. A new public API will be introduced in this class, that accepts a JSONObject parameter.''
 
 
 
==  Implementation ==
 
This guide covers implementation steps for iOS using Xcode and Android using Android Studio.
 
<br />
 
 
 
== Setting up your  Development Environment  ==
 
{{ExampleCode|
 
xCode|
 
<big>
 
'''Configuring Xcode Development Environment'''
 
</big>
 
 
 
Nielsen App SDK is compatible with Apple iOS versions 8.0 and above.
 
 
 
The SDK uses the NSURLSession instead of the deprecated NSURLConnection.
 
 
 
<blockquote>'''Note''': All communications between the SDK and the Census (Collection Facility) use HTTPS.</blockquote>
 
 
 
<big>'''Importing Frameworks'''</big>
 
The first step is to ensure that the following frameworks and libraries are imported into the Frameworks folder of the Xcode project before creating an instance of the Nielsen App SDK object.
 
* UIKit.framework
 
* Foundation.framework
 
* AdSupport.framework
 
* JavascriptCore.framework
 
* WebKit.framework
 
* SystemConfiguration.framework
 
* Security.framework
 
** Nielsen Analytics framework makes use of a number of functions in this library.
 
* AVFoundation.framework
 
* NielsenAppApi.framework
 
* libc++.tbd (as SDK contains Objective C++ source file)
 
** Alternatively, include -lstdc++ in Build Settings → Other Linker Flag of the Xcode project
 
 
 
<blockquote>'''Example'''
 
* Extract “NielsenAppApi.Framework” from the Nielsen App SDK sample app and copy it to Frameworks folder of the Xcode project.
 
* Add the code <code>-#import NielsenAppApi/NielsenAppApi.h</code> to the View Controller’s header file.</blockquote>
 
 
Ensure that the following are included in the Linked Frameworks and Libraries list (located in the project’s Summary settings).
 
* Nielsen App SDK
 
* iOS security framework
 
<br />
 
<big>'''Using Swift'''</big>
 
To import a set of Objective-C files in the same app target as your Swift code, you rely on an Objective-C bridging header to expose those files to Swift. Xcode offers to create this header file when you add a Swift file to an existing Objective-C app, or an Objective-C file to an existing Swift app.
 
 
 
Select File/New File/Objective-C File  <br />
 
Xcode will prompt you to create a bridging header.
 
[[File:bridgingheader 2x.png|600px|center]] <br />
 
Once this file has been created, you need to add the following:
 
<syntaxhighlight lang="swift">
 
#import <NielsenAppApi/NielsenAppApi.h>
 
</syntaxhighlight>
 
<big>'''Using Objective-C'''</big>
 
Add the code
 
<syntaxhighlight lang ="objective-c">
 
#import <NielsenAppApi/NielsenAppApi.h>
 
</syntaxhighlight>
 
to the View Controller’s header file.
 
<br />
 
|Android =
 
<big>'''Configuring Android Development Environment'''</big>'
 
*The Nielsen App SDK (located in the [https://engineeringportal.nielsen.com/docs/Special:Downloads Downloads section] of the website) class is the primary application interface to the Nielsen App SDK on Android.
 
*The Nielsen App SDK class is defined as the only public class belonging to the com.nielsen.app.sdk package.
 
 
 
'''Nielsen App SDK is compatible with Android OS versions 2.3+. Clients can control / configure the protocol to be used – HTTPS or HTTP to suit their needs.'''
 
 
 
The requirement for the Java ''AppSdk.jar'' library and the ''libAppSdk.so'' native library will depend on the type of host application that will make use of them.
 
* '''For Video player applications'''
 
** The Android OS hosting the App SDK should use a media player supporting HLS streaming (Android 3.0 and later will support it natively).
 
** If the player application uses a 3rd party media player implementing its own HLS, then the minimum Android version will be limited to version 2.3, since the SDK depends on Google Play support to work properly.
 
* '''For Audio player applications'''
 
** The Android OS hosting the App SDK should be at version 2.3 and later since the SDK depends on the Google Play support to work properly.
 
Once SDK is downloaded ensure to unzip the Nielsen SDK and copy the AppSdk.jar in your app (Android Studio) libs folder, then right click the AppSdk.jar and select '''Add As Library'''.
 
Ensure the AppSdk.jar file is added in 'build.grade (App Level) file.
 
* App SDK 1.2 provides support for x86, mips, and armeabi-7a architecture.
 
==== Google Play Services ====
 
Add the Google Play Services in the project,
 
Steps: Android Studio -> File -> Project Structure ->(In module selection) select App -> Dependencies (tab) -> Click “+” button and select <code>“com.google.android.gms:play-services”</code>.
 
Ensure it is added in build.gradle (App level) file
 
==== Manifest File ====
 
* Add the following permissions on the project’s ''AndroidManifest.xml'' file.
 
<syntaxhighlight lang="java"><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:required="false" />
 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
 
<uses-permission android:name="android.permission.INTERNET"/></syntaxhighlight>
 
For more details to handle runtime permissions in Android versions, please visit [https://developer.android.com/training/permissions/requesting.html]. 
 
 
 
* In <code>AndroidManifest.xml </code>under <application> node add the following metadata
 
 
 
<syntaxhighlight lang="java"><meta-data
 
android:name="com.google.android.gms.version"
 
android:value="@integer/google_play_services_version"/></syntaxhighlight>
 
 
 
* App SDK checks to see if there is a Google service available and updated.
 
* If not available or updated, App SDK will not use this service when executing its functions and will make reference to missing imports and the app will not be compiled.
 
 
 
==== Library ====
 
Nielsen App SDK uses the following packages/classes from the Google Play service.
 
* google-play-services_lib
 
 
 
==== Classes/package ====
 
 
 
* com.google.android.gms.ads.identifier.AdvertisingIdClient;
 
* com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;
 
* com.google.android.gms.common.ConnectionResult;
 
* com.google.android.gms.common.GooglePlayServicesUtil;
 
* com.google.android.gms.common.GooglePlayServicesRepairableException;
 
* com.google.android.gms.common.GooglePlayServicesNotAvailableException;
 
}}
 
 
 
== SDK Initialization ==
 
The latest version of the Nielsen App SDK allows instantiating multiple instances of the SDK object, which can be used simultaneously without any issue. The sharedInstance API that creates a singleton object was deprecated prior to version 5.1.1. (Version 4.0 for Android)
 
 
 
* A maximum of four SDK instances per appid are supported. When a fifth SDK instance is launched, the SDK will return “nil” from [[initWithAppInfo:delegate:]]
 
 
 
The following table contains the list of arguments that should be passed during initialization.
 
 
 
* The appid is provided by the Nielsen Technical Account Manager (TAM).
 
 
{| class="wikitable"
 
{| class="wikitable"
 +
! style="width: 90px;" | Type
 +
! style="width: 45px;" |
 +
! style="width: 45px;" | OS
 +
!| Implementation Guides for Simplified SDK
 
|-
 
|-
! Parameter / Argument !! Description !! Source !! Required? !! Example
+
| rowspan="8" | {{SmallIcon|SDKIcon.png|alt=SDK}}
|-
 
| appid || Unique id for the application assigned by Nielsen.
 
It is GUID data type, provided by the Nielsen Technical Account Manager (TAM).
 
|| Nielsen-specified || Yes || PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
 
|-
 
| appname || Name of the application || Client-defined || No|| "Nielsen Sample App"
 
|-
 
| appversion || Current version of the app used || Client-defined || No || "1.0.2"
 
|-
 
| sfcode || Nielsen collection facility to which the SDK should connect.
 
'''DTVR'''
 
* "us"
 
'''Digital Audio'''
 
* "drm"
 
'''DCR'''
 
* "dcr"
 
|| Nielsen-specified || Yes || "dcr"
 
|-
 
|containerID || View ID of the UI element used as player view in application for Viewability ||Client-defined||No||"1234567"
 
 
|-
 
|-
|nol_devDebug || Enables Nielsen console logging. Only required for testing ||Nielsen-specified || Optional || "DEBUG"
+
| rowspan="3" | {{OSIcon|VideoIcon.png|alt=Video}}
|}
+
| {{OSIcon|macOSIcon.png|alt=iOS}}
<br />
+
| '''[[Digital Measurement iOS Simplified API]]'''
 
 
 
 
==== Sample SDK Initialization Code ====
 
{{ExampleCode|
 
|Swift  =
 
Swift 4.0 Example:
 
<code>NielsenInit.swift</code>
 
<syntaxhighlight lang="swift">
 
 
 
import Foundation
 
import NielsenAppApi
 
 
 
class NielsenInit : NSObject {
 
    class func createEventTracker(delegate: NielsenEventTrackerDelegate) -> NielsenEventTracker?{
 
   
 
        //Initialising the NielsenEventTracker class by passing app information which returns the instance of NielsenEventTracker.
 
       
 
        var nielsenEventTracker: NielsenEventTracker?
 
       
 
        let appInformation = [
 
 
 
            "appid": "PDA7D5EE6-B1B8-4123-9277-2A788XXXXXXX",
 
            "appversion": "1.0",
 
            "appname": "Amazing app",
 
            "sfcode": "dcr",
 
            "nol_devDebug": "DEBUG",
 
            "containerId": String(containerId)  //Keep container id unique constant, you can use tag property of player.
 
        ]
 
       
 
        nielsenEventTracker = NielsenEventTracker(appInfo:appInformation1, delegate:delegate)
 
        return nielsenEventTracker
 
    }
 
}
 
</syntaxhighlight>
 
 
 
 
 
Sample code: ViewController
 
<br />
 
<code>ViewController.swift</code>
 
 
 
<syntaxhighlight lang="swift">
 
 
 
    override func viewDidLoad() {
 
        super.viewDidLoad()
 
       
 
        //Getting the instance of NielsenEventTracker
 
       
 
        self.nielsenEventTracker = NielsenInit.createEventTracker(delegate: self)
 
</syntaxhighlight>
 
 
 
|Objective C =
 
Initialize the Nielsen App object within the viewDidLoad view controller delegate method using initWithAppInfo:delegate:
 
<blockquote>If App SDK is initialized using init or new methods, it will ignore the API calls resulting in no measurement. The SDK will not return any errors.</blockquote>
 
Objective-C Example:
 
<code>NielsenInit.m</code>
 
<syntaxhighlight lang="objective-c">   
 
#import "NielsenInit.h"
 
#import <NielsenAppApi/NielsenEventTracker.h>
 
 
 
@implementation NielsenInit
 
 
 
+ (NielsenEventTracker *)createNielsenEventTrackerWithDelegate:(id<NielsenEventTrackerDelegate>)delegate
 
{
 
    //Initialising the NielsenEventTracker class by passing app information which returns the instance of NielsenEventTracker.
 
   
 
    NSDictionary *appInformation = @{ @"appid": @"PDA7D5EE6-B1B8-4123-9277-2A788XXXXXXX",
 
                            @"appversion": @"1.0",
 
                            @"appname": @"Objc Test app",
 
                            @"sfcode": @"dcr",
 
                            @"nol_devDebug": @"INFO",
 
                            @"containerId": @"1" };  //Keep container id unique constant, you can use tag property of player.
 
   
 
    return [[NielsenEventTracker alloc] initWithAppInfo:appInformation delegate:delegate];
 
}
 
</syntaxhighlight>
 
 
 
 
 
The following would be the <code>NielsenInit.h</code> file:
 
<syntaxhighlight lang="objective-c">
 
#import <Foundation/Foundation.h>
 
 
 
@class NielsenEventTracker;
 
@protocol NielsenEventTrackerDelegate;
 
 
 
@interface NielsenInit : NSObject
 
 
 
+ (NielsenEventTracker *)createNielsenEventTrackerWithDelegate:(id<NielsenEventTrackerDelegate>)delegate;
 
 
 
@end
 
</syntaxhighlight>
 
 
 
The ViewController.m file could then contain the following line(s):
 
<syntaxhighlight lang="objective-c"> 
 
    //Getting the instance of NielsenEventTracker
 
    nielsenEventTracker = [NielsenInit createNielsenEventTrackerWithDelegate:nil];
 
/////
 
-(void) setPlayHeadPosition {
 
   
 
    //Setting play head position
 
    CMTime timeInterval = CMTimeMakeWithSeconds(1, 1);
 
    [player addPeriodicTimeObserverForInterval:(timeInterval) queue:dispatch_get_main_queue() usingBlock:^(CMTime time){
 
        NSTimeInterval seconds = CMTimeGetSeconds(time);
 
        NSInteger intSec = seconds;
 
        NSString* strSec = [NSString stringWithFormat:@"%li", intSec];
 
       
 
        //updating playHead position in dictionary.
 
        [mutableData setValue:strSec forKey:@"playheadPosition"];
 
       
 
        //Sending data dictionary to SDK with updated playHead position.
 
        [nielsenEventTracker trackEvent:mutableData];
 
    }];
 
}
 
</syntaxhighlight>
 
|Android =
 
 
 
'''Initialization of App SDK object through a JSON object'''
 
<syntaxhighlight lang="java"> 
 
import android.content.Context;
 
import com.nielsen.app.sdk.IAppNotifier;
 
import com.nielsen.app.sdk.NielsenEventTracker;
 
import org.json.JSONException;
 
import org.json.JSONObject;
 
 
 
public class NielsenInit {
 
    private NielsenEventTracker mEventTracker = null;
 
    public NielsenEventTracker initEventTracker(Context mContext, IAppNotifier appNotifier){
 
 
 
        try {
 
            //Initialising the NielsenEventTracker class by passing app information which returns the instance of NielsenEventTracker.
 
 
 
            JSONObject appInformation = new JSONObject()
 
 
 
                    .put("appid", "PDA7D5EE6-B1B8-4123-9277-2A788XXXXXXX")
 
                    .put("appversion", "1.0")
 
                    .put("appname", "Android Test app")
 
                    .put("sfcode", "dcr")
 
                    .put("nol_devDebug", "INFO")
 
                    .put("containerId", "55");      //Keep container id unique constant, you can use tag property of player.
 
 
 
            mEventTracker = new NielsenEventTracker(mContext, appInformation, appNotifier);
 
        } catch (JSONException e) {
 
            e.printStackTrace();
 
        }
 
 
 
        return mEventTracker;
 
    }
 
}
 
 
 
</syntaxhighlight>
 
 
 
}}
 
 
 
== Initializing the Nielsen AppSDK to measure the Viewability ==
 
The integrator to support the viewability metrics in the application has to provide a tag value of the player view to let Nielsen AppSDK know that there is a player that needs to be tracked. It’s called the ‘containerId’ and it should be passed in application info dictionary as string while initializing the Nielsen AppSDK.
 
 
 
==== Android ====
 
{| class="wikitable"
 
 
|-
 
|-
! # !! Parameter Name !! Description !! Supported Values !! Example
+
| {{OSIcon|AndroidIcon.png|alt=Android}}
 +
| '''[[Digital Measurement Android Simplified API]]'''
 
|-
 
|-
| 1 || containerId ||View ID of the UI element used as player view in application. getId() method of View class can be used to get this value. ||A positive integer used to identify the view. || 2131558561
+
| {{OSIcon|BrowserIcon.png|alt=Browser}}
 +
| '''[[Digital Measurement Browser Simplified API]]'''
 
|}
 
|}
  
 +
== Simplified Implementation ==
 +
Only 4 events with the Simplified SDK. Order of calls no longer important.
  
==== iOS ====
 
{| class="wikitable"
 
|-
 
! # !! Parameter Name !! Description !! Supported Values !! Example
 
|-
 
| 1 || containerId ||The tag of the UIView that represents the Player View ||The string value representing the NSInteger value with maximum value of NSIntegerMax that is related on 32- or 64-bit applications. || "100" <br> "2131558561"
 
|}
 
 
For iOS it is required to link additional frameworks that are needed for viewability engine:<br>
 
<code>JavaScriptCore.framework</code> <br>
 
<code>WebKit.framework</code>
 
 
The Nielsen AppSDK uses a tracking WebView (TWV) approach.  For more information on Viewability, please refer to [https://engineeringportal.nielsen.com/docs/Implementing_Viewability_with_AppSDK Implementing Viewability with AppSDK.]
 
 
== APP SDK Error & Event Codes ==
 
To view the Error and Event codes for iOS and Android, please review the [[APP SDK Event Codes|App SDK Event Code]] Reference page.
 
 
== Simplified API Syntax ==
 
The existing API has a number of methods used for reporting player and application state changes to the SDK. The order of calls is important for the SDK in the existing API. In the new simplified API, all these calls will be replaced with one API call that will get one dictionary object with many key-value pairs, where any value could be another complex dictionary object. All the data provided in the older API in separate calls will be provided in one single call.
 
 
Main API call for the new NielsenEventTracker API:
 
{{ExampleCode|
 
xCode|
 
<syntaxhighlight lang="objective-c">
 
- (void)trackEvent:(NSDictionary *)data;
 
</syntaxhighlight>
 
|Android=
 
<syntaxhighlight lang="java">
 
void trackEvent(JSONObject data);
 
</syntaxhighlight>
 
}}
 
 
=== Handling JSON Metadata ===
 
Parameter “data” is a JSON object with many key-value pairs that holds all information required by SDK.
 
 
Format of input object is the following:
 
<syntaxhighlight lang="json">
 
{
 
"event": <event identifier>,
 
"type": <type of metadata>,
 
"metadata":{
 
  "content": <content metadata object>,
 
  "ad": <ad metadata object>,
 
  "static": <static metadata object>
 
},
 
"playheadPosition":<playhead value | UTC>,
 
"id3Data": <id3 payload>,
 
}
 
</syntaxhighlight>
 
<br>
 
=== Event Types ===
 
The New API method supports the following event types:
 
 
{| class="wikitable"
 
{| class="wikitable"
 
!Key
 
!Key
Line 402: Line 49:
 
Should be called at the end of each ad. This event type is required to handle the case when advertisements could not be distinguished, as its assetId is the same.
 
Should be called at the end of each ad. This event type is required to handle the case when advertisements could not be distinguished, as its assetId is the same.
 
|}
 
|}
<br>
 
DCR and DTVR require various levels of data.  Please select the TAB of the product you are interested in reviewing.
 
{{DCRDTVRTabs
 
|DCR=
 
=== Digital Content Ratings===
 
<table>
 
<tr>
 
<th>  Parameter
 
</th>
 
<th> <b>Description</b>
 
</th>
 
<th> <b>Supported values</b>
 
</th>
 
<th> <b>Example</b>
 
</th></tr>
 
<tr>
 
<td> <b>event</b>
 
</td>
 
<td> Event identifier
 
</td>
 
<td>
 
<p><code> String:
 
playhead,pause,complete,
 
adStop</code>
 
</p>
 
</td>
 
<td><syntaxhighlight lang="swift">"event":"playhead"</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>type</b>
 
</td>
 
<td> Determines the metadata object
 
that should be used for crediting.
 
</td>
 
<td>
 
<p><code> String:<br />
 
content,
 
ad,
 
static</code>
 
</p>
 
</td>
 
<td><syntaxhighlight lang="swift">"type":"content"</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>metadata</b>
 
</td>
 
<td> Object that holds metadata values of specific types<br />
 
<p><span style="color:blue"> Detailed in tables below</span>
 
</p>
 
</td>
 
<td> <code>Object</code>
 
</td>
 
<td><syntaxhighlight lang="swift">
 
"metadata":{
 
  "content": <content metadata object>,
 
  "ad": <ad metadata object>,
 
  "static": <static metadata object>
 
},
 
</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>playheadPosition</b>
 
</td>
 
<td> Playhead value or UTC timestamp
 
</td>
 
<td> <code>String</code>
 
</td>
 
<td>
 
<p>Position value is UTC timestamp:
 
<code>
 
"playheadPosition":"1501225191747"</code>
 
</p><p>Position value is playhead:
 
<code>
 
"playheadPosition":"10"</code>
 
</p>
 
</td></tr>
 
</table>
 
=== Content Metadata ===
 
Content metadata sent for every playheadposition update.
 
<table>
 
<tr>
 
<th> Keys </th>
 
<th> Description </th>
 
<th> Example </th>
 
<th> Required
 
</th></tr>
 
<tr>
 
<td>'''assetName''' </td>
 
<td> name of program (100 character limit) </td>
 
<td> <code>"MyTest789"</code> </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''assetid''' </td>
 
<td> unique ID assigned to asset </td>
 
<td> custom </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''length''' </td>
 
<td> length of content in seconds </td>
 
<td> <code>seconds</code> (86400 for live stream) </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''program''' </td>
 
<td>name of program (100 character limit) </td>
 
<td> custom </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''segB''' </td>
 
<td> custom segment B +</td>
 
<td> custom </td>
 
<td>
 
</td></tr>
 
<tr>
 
<td> '''segC''' </td>
 
<td> custom segment C +</td>
 
<td> custom </td>
 
<td>
 
</td></tr>
 
<tr>
 
<td> '''title''' </td>
 
<td>name of program (100 character limit) </td>
 
<td> custom </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td>'''type'''</td>
 
<td><code>'content', 'ad', 'static'</code></td>
 
<td> <code> 'content'</code> </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td>'''section''' </td>
 
<td> Unique Value assigned to page/site section </td>
 
<td> HomePage </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''airdate''' </td>
 
<td> the airdate in the linear TV ++</td>
 
<td> YYYYMMDD HH24:MI:SS </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''isfullepisode''' </td>
 
<td> full episode flag </td>
 
<td> <code>"y"</code>- full episode, <code>"n"</code>- non full episode </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> '''crossId1''' </td>
 
<td> standard episode ID </td>
 
<td> custom </td>
 
<td> ✓
 
</td></tr>
 
<tr>
 
<td> '''crossId2 '''</td>
 
<td> content originator (only required for distributors) </td>
 
<td> Nielsen provided </td>
 
<td>
 
</td></tr>
 
<tr>
 
<td> <b>adloadtype</b>
 
</td>
 
<td> linear vs dynamic ad model
 
</td>
 
<td> 1=Linear
 
2=Dynamic Ads
 
</td>
 
<td>custom
 
</td></tr>
 
</table>
 
+ '''Custom segments''' (segB and segC) can be used to aggregate video and/or static content within a single Brand to receive more granular reports within a brand.<br>
 
++ Acceptable '''Air Date''' Formats:
 
<syntaxhighlight lang="json">
 
YYYYMMDD HH24:MI:SS
 
YYYYMMDDHH24MISS
 
YYYY-MM-DDTHH:MI:SS
 
YYYY-MM-DDHH:MI:SS
 
YYYYMMDDHH:MI:SS
 
MM-DD-YYYY
 
YYYYMMDD HH:MI:SS
 
</syntaxhighlight>
 
<br>
 
For USA all times should be EST, for all other countries Local Time.
 
Below is a sample event for DCR. If no ad or static values, these can be left as blank/null.
 
<syntaxhighlight lang="json">
 
{
 
"event": "playhead",
 
"type": "content",
 
"metadata": {
 
  "content":{
 
    "assetName":"Big Buck Bunny",
 
    "assetid":"B66473",
 
    "length":"3600",
 
    "program":"MyProgram",
 
    "segB":"CustomSegmentValueB",
 
    "segC":"segmentC",
 
    "title":"S2,E3",
 
    "type":"content",
 
    "section":"cloudApi_app",
 
    "airdate":"20180120 10:00:00",
 
    "isfullepisode":"y",
 
    "crossId1":"Standard Episode ID",
 
    "crossId2" :"Content Originator",
 
    "adloadtype":"2"},
 
"ad": {},
 
"static": {}
 
},
 
"playheadPosition": "",
 
}
 
</syntaxhighlight>
 
  
|DTVR=
+
== Single object holds all the data ==
=== Digital TV Ratings info ===
+
All the data provided in the older API in separate calls will be provided in one single call.
<table>
+
Format of input object is the following:
<tr>
 
<th>  Parameter
 
</th>
 
<th> <b>Description</b>
 
</th>
 
<th> <b>Supported values</b>
 
</th>
 
<th> <b>Example</b>
 
</th></tr>
 
<tr>
 
<td> <b>event</b>
 
</td>
 
<td> Event identifier
 
</td>
 
<td>
 
<p><code> String:
 
playhead,pause,complete,
 
adStop</code>
 
</p>
 
</td>
 
<td><syntaxhighlight lang="swift">"event":"playhead"</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>type</b>
 
</td>
 
<td> Determines the metadata object that should be used for crediting.
 
</td>
 
<td>
 
<p><code> String:<br />
 
content,
 
ad,
 
static</code>
 
</p>
 
</td>
 
<td><syntaxhighlight lang="swift">"type":"content"</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>adModel</b>
 
</td>
 
<td> linear vs dynamic ad model
 
</td>
 
<td> 1=Linear
 
2=Dynamic Ads
 
</td>
 
<td>custom
 
</td></tr>
 
<tr>
 
<td> <b>channelName</b>
 
</td>
 
<td> Any string representing the.channel/stream
 
</td>
 
<td> <code>Object</code>
 
</td>
 
<td>custom
 
</td></tr>
 
<tr>
 
<td> <b>playheadPosition</b>
 
</td>
 
<td> Playhead value or UTC timestamp
 
</td>
 
<td> <code>String</code>
 
</td>
 
<td>
 
<p>Position value is UTC timestamp:
 
<code>
 
"playheadPosition":"1501225191747"</code>
 
</p><p>Position value is playhead:
 
<code>
 
"playheadPosition":"10"</code>
 
</p>
 
</td></tr>
 
<tr>
 
<td> <b>id3Data</b>
 
</td>
 
<td> Nielsen ID3 payload string
 
</td>
 
<td> <code>Object</code>
 
</td>
 
<td>
 
<p><code>
 
id3Data: www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg
 
==/_EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60
 
kZO_Ejkcn2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzC
 
yBEoIDv2kA2g1QJmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxa
 
hBcQP5tqbjhyMzdVqrMKuvvJO1jhtSXa9AroChb11ZUnG1W
 
VJx2O4M=/33648/22847/00</code>
 
</p>
 
<tr>
 
 
 
</td></tr>
 
</table>
 
Below is a sample event for DTVR.  If no ad or static values, these can be left as blank/null.
 
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
{  
 
{  
"event": "playhead",
+
"event": <event identifier>,
"type": "content",
+
"type": <type of metadata>,
"metadata": {
+
"metadata":{  
  "content":{
 
    "adModel":"1",
 
    "channelname":"channel1"
 
  },
 
"ad": {},
 
"static": {}
 
},
 
"playheadPosition": "",
 
"id3Data": "www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg==/_
 
EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60kZO_Ejkcn
 
2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzCyBEoIDv2kA2g1Q
 
JmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxahBcQP5tqbjhyMzdVqrMK
 
uvvJO1jhtSXa9AroChb11ZUnG1WVJx2O4M=/33648/22847/00"
 
}
 
</syntaxhighlight>
 
|DCRDTVR=
 
=== Applies to DCR and DTVR ===
 
<table>
 
<tr>
 
<th>  Parameter
 
</th>
 
<th> <b>Description</b>
 
</th>
 
<th> <b>Supported values</b>
 
</th>
 
<th> <b>Example</b>
 
</th></tr>
 
<tr>
 
<td> <b>event</b>
 
</td>
 
<td> Event identifier
 
</td>
 
<td>
 
<p><code> String:
 
playhead,
 
pause,
 
complete,
 
adStop</code>
 
</p>
 
</td>
 
<td><syntaxhighlight lang="swift">"event":"playhead"</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>type</b>
 
</td>
 
<td> Determines the metadata object that should be used for crediting.
 
</td>
 
<td>
 
<p><code> String:<br />
 
content,
 
ad,
 
static</code>
 
</p>
 
</td>
 
<td><syntaxhighlight lang="swift">"type":"content"</syntaxhighlight>
 
</td></tr>
 
<tr>
 
<td> <b>metadata</b>
 
</td>
 
<td> Object that holds metadata values of specific types<br />
 
<p><span style="color:blue"> Detailed in tables below</span>
 
</p>
 
</td>
 
<td> <code>Object</code>
 
</td>
 
<td><syntaxhighlight lang="swift">
 
"metadata":{  
 
 
   "content": <content metadata object>,
 
   "content": <content metadata object>,
 
   "ad": <ad metadata object>,
 
   "ad": <ad metadata object>,
 
   "static": <static metadata object>
 
   "static": <static metadata object>
 
  },
 
  },
</syntaxhighlight>
+
"playheadPosition":<playhead value | UTC>,
</td></tr>
+
"id3Data": <id3 payload>,
<tr>
 
<td> <b>playheadPosition</b>
 
</td>
 
<td> Playhead value or UTC timestamp
 
</td>
 
<td> <code>String</code>
 
</td>
 
<td>
 
<p>Position value is UTC timestamp:
 
<code>
 
"playheadPosition":"1501225191747"</code>
 
</p><p>Position value is playhead:
 
<code>
 
"playheadPosition":"10"</code>
 
</p>
 
</td></tr>
 
<tr>
 
<td> <b>id3Data</b>
 
</td>
 
<td> Nielsen ID3 payload string
 
</td>
 
<td> <code>Object</code>
 
</td>
 
<td>
 
<p><code>
 
id3Data: www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg
 
==/_EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60
 
kZO_Ejkcn2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzC
 
yBEoIDv2kA2g1QJmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxa
 
hBcQP5tqbjhyMzdVqrMKuvvJO1jhtSXa9AroChb11ZUnG1W
 
VJx2O4M=/33648/22847/00</code>
 
</p>
 
</td></tr>
 
<tr>
 
<td> <b>ottData</b>
 
</td>
 
<td> Object that holds ott information
 
</td>
 
<td> <code>Object</code>
 
</td>
 
<td><syntaxhighlight lang="swift">
 
ottData:{
 
ottStatus:1,
 
ottType:casting,
 
ottDevice:chromecast,
 
ottDeviceName:Google ChromeCast,
 
ottDeviceID:1234,
 
ottDeviceModel:ChromeCast,
 
ottDeviceVersion:1.0.0
 
 
}
 
}
</syntaxhighlight>
 
</td></tr>
 
</table>
 
=== Content Metadata ===
 
Content metadata sent for every playheadposition update.
 
<table>
 
<tr>
 
<th> Keys </th>
 
<th> Description </th>
 
<th> Example </th>
 
<th> Required
 
</th></tr>
 
<tr>
 
<td> '''length''' </td>
 
<td> length of content in seconds </td>
 
<td> <code>seconds</code> (86400 for live stream) </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td>'''type'''</td>
 
<td><code>'content', 'ad', 'static'</code></td>
 
<td> <code> 'content'</code> </td>
 
<td> Yes
 
</td></tr>
 
<tr>
 
<td> <b>adModel</b>
 
</td>
 
<td> linear vs dynamic ad model
 
</td>
 
<td> 1=Linear
 
2=Dynamic Ads
 
</td>
 
<td>custom
 
</td></tr>
 
<tr>
 
<td> <b>adloadtype</b>
 
</td>
 
<td> DCR Ad Model
 
</td>
 
<td> 1=Linear
 
2=Dynamic Ads
 
</td>
 
<td>custom
 
</td></tr>
 
</table>
 
+ '''Custom segments''' (segB and segC) can be used to aggregate video and/or static content within a single Brand to receive more granular reports within a brand.<br>
 
++ Acceptable '''Air Date''' Formats:
 
<syntaxhighlight lang="json">
 
YYYYMMDD HH24:MI:SS
 
YYYYMMDDHH24MISS
 
YYYY-MM-DDTHH:MI:SS
 
YYYY-MM-DDHH:MI:SS
 
YYYYMMDDHH:MI:SS
 
MM-DD-YYYY
 
YYYYMMDD HH:MI:SS
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br>
 
<br>
Below is a sample event for DCR/DTVR joint integration. If no ad or static values, these can be left as blank/null.
+
[[File:SimplifiedAPI_vs_StandardAPI_New.jpg|2048px|link=http://engineeringportal.nielsen.com/w/images/9/91/SimplifiedAPI_vs_StandardAPI_New.jpg]]
<syntaxhighlight lang="json">
+
[http://engineeringportal.nielsen.com/w/images/9/91/SimplifiedAPI_vs_StandardAPI_New.jpg Click here to zoom in on image]
{
 
"event": "playhead",
 
"type": "content",
 
"metadata": {
 
  "content":{
 
    "type":"content",
 
    "length":"86400",
 
    "adModel":"1",
 
    "adloadtype":"1"},
 
  "ad": {},
 
  "static": {}
 
},
 
"playheadPosition": "",
 
"id3Data": "www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg==/_
 
EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60kZO_Ejkcn
 
2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzCyBEoIDv2kA2g1Q
 
JmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxahBcQP5tqbjhyMzdVqrMK
 
uvvJO1jhtSXa9AroChb11ZUnG1WVJx2O4M=/33648/22847/00"
 
}
 
</syntaxhighlight>
 
}}
 
 
 
=== Ad Metadata ===
 
The ad metadata (if applicable) should be passed for each individual ad, if ads are available during or before the stream begins.
 
<br/>
 
{| class="wikitable"
 
|-
 
! Keys !! Description !! Values !! Example
 
|-
 
| assetid || unique ID assigned to ad || custom <br>(no [[Special Characters]]) || <code>'AD1234'</code>
 
|-
 
| title || unique name assigned to ad || custom ||<code>'ADtitle'</code>
 
|-
 
|adldx || Ad Index (*See Note below*) || custom || <code> "66478364" </code>
 
|-
 
| type || type of ad || 'preroll', 'midroll', or 'postroll' || <code>'preroll'</code>
 
|-
 
|length || length of ad || In Seconds ||<code> '20' </code>
 
|}
 
=== Ad Metadata Sample ===
 
<syntaxhighlight lang="json">
 
{
 
  "ad": {
 
    "assetid":"AD12345",
 
    "title":"ADTestTitle",
 
    "adldx":"1",
 
    "type":"preroll",
 
    "length":"20"
 
  },
 
}
 
</syntaxhighlight>
 
 
 
=== Managing Ads ===
 
If there is an Ad block within the playing content (such as a midroll) you need to:
 
* Reset the playhead position to 0 for each ad.
 
* Call the '''adStop''' event at the end of each ad or increment the adldx
 
 
 
The Simplified SDK will can automatically detect the change from ad to content, or even ad to ad if the assetID changes; however, there could be situations where the same ad is played back to back.  You can either increment/change the '''adldx value''', and/or call adStop at the end of each Ad.
 
 
 
Sometimes it is not possible for integrators to provide different assetId value for individual ads in a sequence of ads. Taking this into account the Nielsen Simplified API will support a new parameter for ad metadata: '''adIdx.''' This parameter is just an index of an individual ad in a sequence of ads. Once the next ad is started the '''adIdx''' parameter should be changed and provided as part of ad metadata.
 
 
 
<syntaxhighlight lang="swift">
 
            // Example of passing both values
 
            self.data.updateValue("adStop", forKey: "event")
 
            self.data.updateValue("223", forKey: "adldx")
 
            self.nielsenEventTracker.trackEvent(data)
 
</syntaxhighlight>
 
 
 
=== Static Metadata ===
 
{| class="wikitable"
 
|-
 
! Keys !! Description !! Values !! Required
 
|-
 
| type || type identifier || <code> "static" </code> || ✓
 
|-
 
| assetid || unique ID assigned for each article/section || custom || ✓
 
|-
 
|section || Unique Value assigned to page/site section || HomePage || Yes
 
|-
 
| segA ||name of program (25 character limit) || custom || Yes
 
|-
 
| segB || custom segment B || custom ||
 
|-
 
| segC || custom segment C || custom ||
 
|-
 
|}
 
<syntaxhighlight lang="json">
 
{
 
    "static":
 
            {
 
                "type": "static",
 
                "section": "homeSection",
 
                "assetid": "AID885-9984",
 
                "segA": "CustomSegmentValueA",
 
                "segB": "CustomSegmentValueB",
 
                "segC": "CustomSegmentValueC",
 
            }
 
        },
 
</syntaxhighlight>
 
 
 
=== Putting it all together ===
 
{{ExampleCode|
 
|Swift =
 
<syntaxhighlight lang="swift">
 
      func loadPreRollAd() -> [String : Any] {
 
       
 
        //Loading Ad data
 
       
 
        url = NSURL(string: "http://www.nielseninternet.com/NWCC-3002/prog_index.m3u8")
 
       
 
        let content = [
 
            "assetName":"Big Buck Bunny",
 
            "assetid":"B66473",
 
            "length":"3600",
 
            "program":"MyProgram",
 
            "segB":"CustomSegmentValueB",
 
            "segC":"segmentC",
 
            "title":"S2,E3",
 
            "type":"content",
 
            "section":"app_Mainpage",
 
            "airdate":"20180120 10:00:00",
 
            "isfullepisode":"y",
 
            "crossId1":"Standard Episode ID",
 
            "crossId2" :"Content Originator",
 
            "adloadtype":"2"
 
        ]
 
         
 
        let staticObj = [
 
            "type":"static",
 
            "section":"homeSection",
 
            "segA":"CustomSegmentValueA",
 
            "segB":"CustomSegmentValueB",
 
            "segC":"CustomSegmentValueC"
 
            ]
 
 
 
        let ad = [
 
            "assetid":"AD12345",
 
            "title":"ADTestTitle",
 
            "adldx":"1",
 
            "type":"preroll",
 
            "length":"20"
 
        ]
 
       
 
        let metadata = [
 
            "content" : content,
 
            "ad" : ad,
 
            "static" : staticObj
 
            ] as [String : Any]
 
       
 
       
 
        let data = [
 
            "metadata" : metadata,
 
            "event": "playhead",
 
            "playheadPosition": "0",
 
            "type": "ad",
 
            ] as [String : Any]
 
       
 
        return data   
 
    }
 
</syntaxhighlight>   
 
|Objective C = <syntaxhighlight lang="objective-c">
 
#import <Foundation/Foundation.h>
 
#import "SDKMethods.h"
 
 
 
@implementation SDKMethods
 
//Loading content Data
 
- (NSDictionary *)loadContentData
 
{
 
- (NSDictionary *)loadPreRollAd
 
{
 
    self.url = [NSURL URLWithString:@"http://www.nielseninternet.com/NWCC-3002/prog_index.m3u8"];
 
   
 
    //We should pass content dictionary also in Ad video.
 
    NSDictionary *content = @{  @"assetName":@"ChromeCast1",
 
                                @"assetid":@"C77664",
 
                                @"length":@"3600",
 
                                @"program":@"MyProgram",
 
                                @"segB":@"CustomSegmentValueB",
 
                                @"segC":@"segmentC",
 
                                @"title":@"S2,E3",
 
                                @"type":@"content",
 
                                @"section":@"app_Mainpage",
 
                                @"airdate":@"20180120 10:00:00",
 
                                @"isfullepisode":@"y",
 
                                @"adloadtype":@"2",
 
                                @"channelName":@"My Channel 1",
 
                                @"pipMode":@"false" };
 
   
 
    NSDictionary *ad = @{ @"assetid":@"AD12345",
 
                          @"title":@"ADTestTitle",
 
                          @"type":@"preroll",
 
                          @"length":@"20" };
 
 
 
  NSDictionary *staticObj = @{ @"type":@"static",
 
                              @"section":@"homeSection",
 
                              @"segA":@"CustomSegmentValueA",
 
                              @"segB":@"CustomSegmentValueB",
 
                              @"segC":@"CustomSegmentValueC" };
 
   
 
    //static data should be empty in Ad video
 
    NSDictionary *metadata = @{  @"content" : content,
 
                                @"ad" : ad,
 
                                @"static" :  @staticObj };
 
   
 
    NSDictionary *data = @{  @"metadata" : metadata,
 
                            @"event": @"playhead",
 
                            @"type": @"ad",
 
                            @"playheadPosition": @"0" };
 
   
 
    return data;
 
}
 
</syntaxhighlight>
 
|Android = <syntaxhighlight lang="java">
 
  //Loading Ad data
 
    public JSONObject loadPreRollAdData(){
 
        JSONObject data = null;
 
 
 
        url = "http://www.nielseninternet.com/NWCC-3002/prog_index.m3u8";
 
 
 
        try {
 
            //We should pass content dictionary also in Ad video.
 
            JSONObject content = new JSONObject()
 
                    .put( "assetName","ChromeCast1")
 
                    .put( "assetid","C77664")
 
                    .put( "length","3600")
 
                    .put( "program","MyProgram")
 
                    .put( "segB","CustomSegmentValueB")
 
                    .put( "segC","segmentC")
 
                    .put( "title","S2,E3")
 
                    .put( "type","content")
 
                    .put( "section","app_Mainpage")
 
                    .put( "airdate","20180207 10:00:00")
 
                    .put( "isfullepisode","y")
 
                    .put( "adloadtype","2");
 
 
 
            JSONObject ad = new JSONObject()
 
                    .put("type", "static")
 
                    .put("assetid", "AD12345")
 
                    .put("title", "ADTestTitle")
 
                    .put("type", "preroll")
 
                    .put("length", "20");
 
 
 
            JSONObject staticObj = new JSONObject()
 
                    .put("type","static")
 
                    .put("section","homeSection")
 
                    .put("segA","CustomSegmentValueA")
 
                    .put("segB","CustomSegmentValueB")
 
                    .put("segC","CustomSegmentValueC");
 
 
 
            JSONObject metaData = new JSONObject()
 
                    .put("content", content)
 
                    .put("ad", ad)
 
                    .put("static", staticObj);
 
 
 
            data = new JSONObject()
 
                    .put("metadata", metaData)
 
                    .put("event", "playhead")
 
                    .put("type", "ad")
 
                    .put("playheadPosition", "0");
 
 
 
        } catch (JSONException e) {
 
            e.printStackTrace();
 
        }
 
 
 
        return data;
 
    }
 
}
 
</syntaxhighlight> 
 
}}
 
 
 
== JSON examples ==
 
Additional JSON examples such as:
 
* [[JSON examples Simplified API|Static Metadata Only]]
 
* [[JSON examples Simplified API|Ad Metadata Example]]
 
* [[JSON examples Simplified API|ID3 payload for DTVR]]
 
* [[JSON examples Simplified API|Sample Pause Event]]
 
* [[JSON examples Simplified API|Sample Complete Event]]
 
 
 
== Handling Foreground and Background states ==
 
{{ExampleCode|
 
iOS|
 
For iOS, background/foreground detection is handled by the app lifecylce APIs which are provided by [https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html Apple:]
 
 
 
Foreground/Background state measurement is a requirement of Nielsen AppSDK implementation which is especially crucial for static measurement.
 
|Android=
 
 
 
Foreground/Background state measurement is a requirement of Nielsen AppSDK implementation which is especially crucial for static measurement. It may be implemented in multiple ways for Android. This includes
 
* Enable the Nielsen SDK to measure background/foreground state by makingthe relevant update to the AndroidManifest.
 
* Integrate Nielsen’s SdkBgFgDetectionUtility class within your Custom Application Class.
 
* Custom implementation of the required methods within your application.
 
 
 
=== ForeGround/Background Measurement via AndroidManifest ===
 
The simplest way to measure the app background/foreground state is to add the following application tag to the Manifest XML. Integrating this into the Manifest XML will enable the SDK to measure app state directly. This approach is supported for Android 4.0 and up only; it requires that the application class is not in use for some other purpose.
 
<syntaxhighlight lang="java">
 
<application android:name="com.nielsen.app.sdk.AppSdkApplication">
 
</syntaxhighlight>
 
 
 
=== Using the Android SdkBgFbDetectionUtility Class ===
 
For developers who are already using the application class, it is recommended that background/foreground state is implemented using the  [https://engineeringportal.nielsen.com/docs/Android_Background_Foreground SdkBgFgDetectionUtility class].  The  [https://engineeringportal.nielsen.com/docs/Android_Background_Foreground SdkBgFgDetectionUtility class] is compatible with Android 4+ and has been made available to Nielsen clients.
 
 
 
=== Manual Background/ForeGround State Management ===
 
In cases where the developer is not able to use the AndroidManifest.xml solution nor the Nielsen provided  [https://engineeringportal.nielsen.com/docs/Android_Background_Foreground SdkBgFgDetectionUtility class] the developer will need to manually identify the change of state through the application and call the respective API (appInForeground() or appInBackground()) to inform the SDK regarding the change of state from background to foreground or foreground to background.
 
 
 
The SDK is informed about app state using the below methods.
 
<syntaxhighlight lang="java">
 
AppLaunchMeasurementManager.appInForeground(getApplicationContext());
 
AppLaunchMeasurementManager.appInBackground(getApplicationContext());
 
</syntaxhighlight>
 
Within the lifecycle of individual activities, onResume() and onPause() are best suited to providing indication of the app state.
 
 
 
 
 
Correct measurement of the foreground/background state is crucial to Static App measurement within Nielsen Digital Content Ratings (DCR).
 
}}
 
 
 
== Privacy and Opt-Out ==
 
 
 
Users must either have access to the "About Nielsen Measurement" page, or have similar text available within the native app. Include "About Nielsen Measurement" and "Your Choices" link in the Privacy Policy / EULA or as a button near the link to the app's Privacy Policy.
 
 
 
* URL to this web page should be called from SDK by invoking  userOptOutURLString() and opened in 'WebView' / External browser.
 
* If the App SDK returns NULL as Opt-Out URL, handle the exception gracefully and retry later.
 
* To retrieve the current Opt-Out status of a device, use the userOptOutURLString() method.
 
<syntaxhighlight lang ="swift ">
 
public String userOptOutURLString()
 
public boolean getOptOutStatus()
 
</syntaxhighlight>
 
<br>
 
Users can opt out or opt back into Nielsen Measurement. Opt-Out feature relies on the system setting – "Limit Ad Tracking". The setting can be accessed in the Settings application on any device. User is opted out of Nielsen online measurement research when the "Limit Ad Tracking" setting is enabled.
 
 
 
In addition, the following text must be included in your app store description.
 
 
 
'''"Please note: This app features Nielsen’s proprietary measurement software which contributes to market research, like Nielsen’s TV Ratings. Please see http://www.nielsen.com/digitalprivacy for more information"'''
 
 
 
== Sample Applications ==
 
 
 
The below sample applications have been designed to show the Simplified API's functionality and are broken into two distinct categories:
 
* '''Basic''' - To show the functionality of the Nielsen Simplified API using a standard no-frills player.
 
** [[Simplified SDK API-Swift4|Swift 4.0 Sample]]
 
** [[Simplified SDK API-Objective-C|Objective-C Sample]]
 
** [[Simplified SDK API-Android|Android Studio Example]]
 
 
 
* '''Advanced''' - Nielsen Simplified API integrated into a custom video player.
 
** [https://engineeringportal.nielsen.com/w/downloads/digital/sampleapplications/NielsenSampleVideoPlayerSwiftNewApi.zip Swift 4.0 Sample]
 
** [https://engineeringportal.nielsen.com/w/downloads/digital/sampleapplications/NielsenSampleVideoPlayerNewApi.zip Objective-C Sample]
 
** Java/Android Studio Sample
 

Latest revision as of 18:01, 20 October 2022

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png DCR & DTVR breadcrumbArrow.png Simplified SDK API


Introduction

This document outlines the features of the new Simplified Nielsen SDK, which is available for use within your APP or online video site, which simplifies the integration of Nielsen measurement for Digital Content Ratings or DTVR. You are only required to execute one of 4 events. Tell the SDK if you want to track 'content', an 'ad', or a 'static' page load. If an event is sent out of sequence, this new API will put it in the correct order for processing. All of the Standard SDK calls can be replaced with one API call, and one dictionary object, where any value could be another complex dictionary object.
NOTE: use of simplified API is not recommended for BrowserSDK implementations at this time.

Implementation Guides

Type OS Implementation Guides for Simplified SDK
SDKIcon.png
Video
iOS
Digital Measurement iOS Simplified API
Android
Digital Measurement Android Simplified API
Browser
Digital Measurement Browser Simplified API

Simplified Implementation

Only 4 events with the Simplified SDK. Order of calls no longer important.

Key Description
playhead

It is used to pass content, ad or static metadata, the current playhead value, UTC timestamp or id3 payload, ott information to the SDK.

pause

This event should be used to in the following cases: application enters background, any application interruptions, content playback is paused. (Pause is detected by SDK automatically only if time gap between commands in more than 30 minutes.)

complete

It is called when session is completed or ends.

adStop

Should be called at the end of each ad. This event type is required to handle the case when advertisements could not be distinguished, as its assetId is the same.

Single object holds all the data

All the data provided in the older API in separate calls will be provided in one single call. Format of input object is the following:

{ 
 "event": <event identifier>,
 "type": <type of metadata>,
 "metadata":{ 
   "content": <content metadata object>,
   "ad": <ad metadata object>,
   "static": <static metadata object>
 },
 "playheadPosition":<playhead value | UTC>,
 "id3Data": <id3 payload>,
}


SimplifiedAPI vs StandardAPI New.jpg Click here to zoom in on image