DCR & DTVR iOS Adobe Launch Extension

From Engineering Client Portal

Revision as of 21:49, 11 January 2019 by Admin3 (talk | contribs) (Created page with "{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}} {{CurrentBreadcrumb}} Category:Digital = Adobe Launch Extensions = Adobe Launch Extensions are building b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png DCR & DTVR breadcrumbArrow.png DCR & DTVR iOS Adobe Launch Extension

Adobe Launch Extensions

Adobe Launch Extensions are building blocks for mobile application development. The necessary functionality can be implemented independently and put to separate Extensions, but make them able to communicate using Events. These extensions live on Artifactory servers and can be used by clients who develop their mobile applications.

Nielsen AppSDK Extension

Nielsen provides the Adobe Launch Extension based on AppSDK for measuring the video/audio content. It has the name Nielsen AppSDK Extension and is available for android and iOS mobile platforms.

Extension Installation and Configuration

Adobe has developed an Extension to simplify adding Nielsen measurement into your video stream. The first step is to create and publish a property which is outlined in the Getting Started Guide.

Configure the Extension

If the user doesn’t want to set the configuration in the code and wants to make the configuration more flexible and changeable on the fly, it can be configured through the interface. In order to do that, go to the collection of installed extensions of the property. icon

How to add the Nielsen AppSDK extension to a Project in iOS

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 30 thousand libraries and is used in over 1.9 million apps. The Nielsen SDK now uses this distribution framework for improved version management.

Initial Configuration

The Nielsen SDK integration requires Cocoapods 1.4.0. or higher. The full installation guide for this framework is provided on the Getting Started page. How to set up the Podfile is mentioned in Using Cocoapods page.

Repository Credentials

The first step is to add the credentials received from Nielsen into your .netrc file. Navigate to your home folder and create a file called .netrc

cd ~/
vi .netrc

Within this file you need to add your credentials in the following format:

machine raw.githubusercontent.com
login <Nielsen App SDK client>
password <Auth token>

Your Credentials are:

machine raw.githubusercontent.com
login NielsenSdkRepo
password edec0d01b953171c704188c1d8fc0aa4217ec506

Verify version of Cocoapods

First verify that Cocoapods is installed.

pod --version

If it is not, then install.

Install via gem
sudo gem install cocoapods
Install using homebrew
brew install cocoapods

Add Cocoapod repository

From the command line, type the following:

pod repo add NielsenAppSDKExtension https://github.com/nielsendigitalsdk/nielsenappsdkextension-ios-specs.git

It is also recommended to add the repo source into your podfile to avoid any cache issues. (See examples below) Make sure you run the pod init command in your **project's directory.**

pod init

You now need to slightly modify the PodFile that was created in this directory. The following must be in the PodFile:

Podfile

platform :ios, '11.0'
source 'https://github.com/NielsenDigitalSDK/nielsenappsdkextension-ios-specs.git'
source 'https://github.com/CocoaPods/Specs.git'

target 'YourProjectsNameHere' do
    #Pods for ApplicationTarget
    pod 'NielsenAppSDKExtension'
end


Once that has been edited, you can now execute the install:

pod install

Cocoapods will automatically create a new file with extension “.xcworkspace”. From this moment, that file should be used for using the target project instead of previous one with extension “.xcodeproj”. Inside of this workspace you will see “Pods” target which will include ready to use NielsenAppSDKExtension framework.

Open the file with the extension of .xcworkspace file using Xcode.

Integration

As per integration requirements provided by Adobe, the Extension object can be registered and created only once, and its instance is not accessible from the outside - the ACPCore keeps and doesn’t expose it.

Swift

ACPCore.setLogLevel(.debug)
ACPCore.setPrivacyStatus(.optIn)
do {
        NielsenAppSDKExtension.registerListener(forSDKNotifier: NielsenAppSDKEventListener.self)
        try ACPCore.registerExtension(NielsenAppSDKExtension.self)
} catch (let exception) {
        print("Exception: \(exception)")
}

ACPCore.configure(withAppId: Your Adobe Launch Property Key)

ACPCore.start {}

Objective-C

[ACPCore setLogLevel:ACPMobileLogLevelDebug];
[ACPCore setPrivacyStatus:ACPMobilePrivacyStatusOptIn];
NSError *error = nil;

[ACPCore registerExtension:NielsenAppSDKExtension.class error:&error];
if (error)
{
    NSLog(@"%@", error);
}

[ACPCore configureWithAppId:@Your Adobe Launch Property Key””];
[ACPCore start:^{}];

Communication

The communication with the Extension happens by two separate flows: API and Events. The first one just redirects Extension’s class-access methods to direct instances of the NielsenAppSDK. The second one works with ACPCore’s EventHub - the core of the extension. Through the Hub the Core receives all the events and notifies the listeners if they are subscribed for them.

NOTE: be aware of mixing the approaches. Because of different architectures for API approach and Event approach (and the asynchronous nature of Events), it is not guaranteed that events and API will be handled in order of their call.

The list of APIs (the meaning of each event and API is described later in this document)

Public APIs exposed by extension

+ (NSDictionary *)instantiateSDKWithConfiguration:(NSDictionary *)configuration;
+ (NSDictionary *)instantiateSDKWithRemoteConfiguration;
+ (NSDictionary *)removeSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)trackEvent:(NSDictionary *)event forSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)optOutStatusForSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)appDisableForSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)setAppDisable:(BOOL)appDisable forSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)debugForSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)setDebug:(BOOL)debug forSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)demographicIdForSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)optOutURLForSDKWithIdentifier:(NSString *)identifier;
+ (NSDictionary *)meterVersionForSDKWithIdentifier:(NSString *)identifier;
+ (void)registerListenerForSDKNotifier:(Class)aClass;

Additional Resources

For more information on CocoaPods or How to set up the Profile in the Using Cocoapods page.