Ads SDK Recommends Edition Integration Guide

The following steps outline the basic Recommends integration process and should result in the integrator being able to successfully test Recommends content loading in the application.

NOTE: Integration examples are provided in Kotlin and Swift. Examples can also be provided for Objective-C and Java if needed.

Prerequisites

The Ads SDK is available for both Android and iOS platforms.

Android Prerequisites iOS Prerequisites
Android version 4.4 and up (API level 19+) iOS 10+
Android Build Tools 29 Xcode 12.0+
Gradle-based build system CocoaPods 1.8.4+
Build environment with Java 8  

You will need to work with your partner account manager to set up a Recommends account and module that can be used in your integration for launch. For more details please see the Recommends Module developer guide.

Configure Your Project

The Ads SDK is available via a maven repository (https://artifactory.verizonmedia.com/artifactory/maven/) on Android and CocoaPods on iOS. Add the SDK to your project by adding the following lines to your app’s build.gradle or Podfile:

dependencies {
  implementation 'com.verizon.ads:android-vas-recommends-edition:1.3.3'
  implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
  implementation 'androidx.browser:browser:1.2.0'
}
repositories {
  maven {
    url 'https://artifactory.verizonmedia.com/artifactory/maven/'
  }
}
platform :ios, '10.0'

target 'MyApp' do
  use_frameworks!
  project "MyApp.xcproj"
  pod 'Verizon-Ads-RecommendsEdition', '1.4.1'
end

[iOS Only] Enable SKAdNetwork

The Ads SDK supports attribution tracking via Apple’s SKAdNetwork framework. This allows Yahoo as well as participating third-party ad buyers to attribute app installs in the absence of the mobile device ID such as IDFA, which was removed due to the App Tracking Transparency introduced in iOS version 14.5.

Update your app’s Info.plist file and add a SKAdNetworkItems key with an additional dictionary that includes Yahoo’s SKAdnetwork ID, as well as our third-party buyers’ SKAdnetwork IDs. An up to date list of our 3rd party buyers is available here. In addition, you will also need to add your app’s App Store ID in VerizonAdsSourceAppId key. See example below.

<key>SKAdNetworkItems</key>
  <array>
    <dict>
      <key>SKAdNetworkIdentifier</key>
      	<string>e5fvkxwrpn.skadnetwork</string>
    </dict>
  </array>


<key>VerizonAdsSourceAppId</key>
  <string>Replace_this_with_your_App's_App_Store_ID</string>

Permissions

Android

It is recommended, but not required, that the ACCESS_FINE_LOCATION permission is also added to your AndroidManifest.xml so that the Recommends Edition can utilize the location data for targeting purposes to provide more relevant demand. See the sample app for examples on how to request permissions from users at runtime.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

iOS

It is recommended, but not required, that location permissions are requested so that the Recommends Edition can utilize location data for targeting purposes to provide more relevant demand. See the link above and the sample app for examples on how to configure your Info.plist and then request permissions from users at runtime.

Initializing the SDK

SDK Setup

Before the Recommends control can be utilized, the Ads SDK must be initialized and configured with a few important pieces of information. The initialization process requires a unique identifier for the publisher along with any privacy settings around COPPA, GDPR and CCPA compliance.

Further details around privacy compliance and settings can be found here.

// Initialization should occur within the onCreate method of your
// Application subclass. Calling this method anywhere else is not supported

// Import the edition into your project
import com.verizon.ads.edition.RecommendsEdition

// Initialize the SDK with your Application ID
RecommendsEdition.initialize(<Application context>, <YOUR APPLICATION ID>)
// A best practice for initializing is in the app delegate’s
// application(_:didFinishLaunchingWithOptions:) method

// Import the edition to be embedded in your app.
import VerizonAdsRecommendsEdition

// Initialize the edition with your site ID
VASRecommendsEdition.initialize(withSiteId:<YOUR_APPLICATION_ID>)

Android ProGuard

If using ProGuard to minify your app, include the following in your ProGuard config file:

-keepclassmembers class com.verizon.ads** {
public *;
}
-keep class com.verizon.ads**

iOS Network Access

Add the following to the info.plist for the project to allow Recommends content to be loaded and displayed successfully.

<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

Next Step

Create a Recommends Control