Integrating with Nielsen on iOS

Integrate Nielsen functionality into your Ooyala iOS applications.

With the Ooyala Nielsen Plugin for iOS, you can add Nielsen functionality to your Ooyala iOS applications. Ooyala provides:

  • the Ooyala iOS Nielsen Software Development Kit, which includes the JAR file and the API reference documentation
  • a sample application (AnalyticsPluginSampleApp), which shows how to initialize a Nielsen-enabled player and allow the user to opt out of Nielsen tracking


  • You must have a registered account with Nielsen.
  • You will need your account ID.
  • You must obtain the Nielsen libraries from Nielsen, add them to your development environment, and link to them according to Nielsen's instructions.


Add Nielsen Integration to Your iOS Application

The Ooyala Nielsen integration sample app (AnalyticsPluginSampleApp) shows the basics for providing Nielsen integration in your iOS app. This section focuses on significant code snippets in the sample app that apply to Nielsen integration.
In addition to the standard imports, the sample begins by linking the binary with the libraries, importing the following frameworks:
#import <OoyalaNielsenSDK/OONielsenPlugin.h>
#import <NielsenAppApi/NielsenAppApi.h>
The sample app next provides a place where you can specify the AppID and sfCode.
NSString * const SFCODE = @"PUT YOUR SFCODE HERE";    
Argument Description
appID Nielsen-assigned unique id for your application.
sfCode Nielsen collection facility to which the SDK should connect. Nielsen typically assigns different codes for test and production.
Next, the sample app creates a standard OOOoyalaPlayer, and then creates an OONielsenPlugin using that OOOoyalaPlayer.
// Create Ooyala ViewController
OOOoyalaPlayer *player = [[OOOoyalaPlayer alloc] initWithPcode:_pcode domain:[[OOPlayerDomain alloc] initWithString:_playerDomain]];
_ooyalaPlayerViewController = [[OOOoyalaPlayerViewController alloc] initWithPlayer:player];

NSDictionary *parameters = @{@"longitude":@"37.783", @"latitude":@"122.417"};
_nielsenPlugin = [[OONielsenPlugin alloc] initWithPlayer:_ooyalaPlayerViewController.player appId:APPID appVersion:@"0.1" appName:@"OoyalaNielsenSampleApp" sfcode:SFCODE parameters:parameters];      
Note that the initWithPlayer call passes the appID and sfCode arguments, along with other standard Nielsen arguments (appVersion and appName). For more information about these arguments, refer to the API reference documentation included in the Ooyala iOS Nielsen SDK distribution that you downloaded. You can pass optional custom JSON data in the parameters argument to Nielsen's App SDK, such as dma, cccode, or (in the sample app), geocoding information (longitude and latitude).
Note: Nielsen requires data to meet certain restrictions for valid strings. Refer to the Nielsen App API Developer Guide for details.

Finally, the sample app attaches the Nielsen-enabled player to the current view.

The sample app also implements the Nielsen opt-out requirement.

- (IBAction)onOptButton:(id)sender {
  UIViewController *webController = [UIViewController new];
  UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
  webView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
  webView.scalesPageToFit = YES;
  NielsenAppApi *api = [_nielsenPlugin getNielsenAppApi];
  NSString *optOutUrl = [api optOutURLString];
  [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:optOutUrl]]];
  [webView setDelegate:self];
  [webController.view addSubview:webView];
  [self.navigationController pushViewController:webController animated:YES];

Note that the code retrieves the Nielsen opt-out URL by calling Ooyala's getNielsenAppApi method, and then calling optOutURLString on the NielsenAppApi object.

Review the AnalyticsPluginSampleApp for additional details on Nielsen integration in Ooyala iOS apps.