NextGen SDK | iOS | AdMob Integration

Integration Guide for Publishers with AdMob as a Primary

(iOS SDK version 21.3.1)

Important Details About GDPR

As a publisher, you should integrate a Consent Management Platform (CMP) and request for vendor and purpose consents as outlined in IAB Europe’s Mobile In-App CMP API v1.0: Transparency & Consent Framework. You can find a reference implementation of a web-based CMP and the corresponding native wrappers here in the IAB’s GDPR-Transparency-and-Consent-Framework.

If you are embedding your own custom CMP, the collected end-user consent information needs to be stored in NSUserDefaults using the following keys:

Key Type Description
IABConsent_CMPPresent BOOL

Set to “YES” if a CMP that follows the IAB specification is present in the application.

IABConsent_SubjectToGDPR NSString

1” = Subject to GDPR
0” = Not subject to GDPR
-1” = Undetermined (default before initialization)



Base64-encoded consent string as defined in Consent string and vendor list format v1.1
IABConsent_ParsedPurposeConsents NSString String of “0”s and “1”s, where the character at position N indicates the consent status to purposeID N as defined in the Global Vendor List


String of “0”s and “1”s, where the character at position N indicates the consent status to vendorID N as defined in the Global Vendor List

Example code

// User is not subject to GDPR
[[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:@"IABConsent_SubjectToGDPR"];

Important Details About CCPA

The California Consumer Privacy Act (CCPA) was created to provide California consumers with greater transparency and control over their personal information. In many ways, the CCPA is a first of its kind regulation in the United States that seeks to create broad privacy and data protection rules that apply to all industries doing business in the jurisdiction of California, rather than focusing on a single sector or specific data collection and use practices.

For more information about the CCPA regulation, please check out the Smaato FAQ. You can also review the IAB’s U.S. Privacy String documentation.

For Publishers with California-Based Users

As a publisher, you need to make sure to request consent from California-based users (to give or refuse consent / to opt-out or opt-in ) about private data transfer. This answer should be saved in NSUserDefaults with key “IABUSPrivacy_String” in the US Privacy String format (CCPA Opt-Out Storage Format).

Sample of US Privacy String Saving in NSUserDefaults


- (void)saveCCPAUsPrivacyString:(NSString *)usString
    if (usString.length > 0) {
        [NSUserDefaults.standardUserDefaults setObject:usString 
forKey:@"IABUSPrivacy_String"]; // for example "1YNN"


private func saveCCPA(usPrivacy string: String?) {
    guard let usString = string else {
    UserDefaults.standard.set(usString, forKey: "IABUSPrivacy_String" // for example "1YNN")

NextGen SDK reads that value by key “IABUSPrivacy_String” if it exists and uses it as an optional parameter for all ad requests.


Important Note About Fullscreen Adspaces

Currently, only the Interstitial Multi-Ad Format is compatible for Fullscreen Adspaces with Smaato NextGen SDK. In order to monetize your fullscreen Adspaces in SPX with Smaato NextGen SDK, you need to select the option for Interstitial (Display & Video). All other Fullscreen options will not work at this time.

Please check if the Interstitial (Display & Video) feature is enabled in your SPX account. If you do not see the option for Interstitial (Display & Video) in the Ad Format dropdown, please contact your Smaato Account Manager to enable this.

  • When creating your Fullscreen Adspaces in SPX, choose the Interstitial (Display & video) option as the Ad format. (Image 1)
  • For the Creative Type you will have three options to choose from (Image 2):
    • Display Only for Rich Media Ads.
    • Video Only for Video Ads.
    • Display and Video will support either Rich Media or Video Ads.

Image 1: Ad Format dropdown selection

Image 2: Creative Type dropdown selections

Ads for Testing Purposes

Publisher ID: 1100042525  
Adspace ID Type Description
130626424 Rich Media Banner / Med-rect / Leaderboard / Skyscraper
130635694 Static Image Banner / Med-rect / Leaderboard / Skyscraper
130635706 MRAID Banner / Med-rect / Leaderboard / Skyscraper
130626426 Rich Media / Video Interstitial (Video with an end-card + Rich Media Interstitial for 320×480, 480×320, 1024×768 & 768×1024)
130626427 Video Skippable Video
130626428 Rewarded Rewarded Video
130635048 Rewarded Rewarded Video without an end-card

AdMob Dashboard Setup

1. Go to the AdMob Dashboard –

2. Click on “Create Mediation Group” button

3. Select Ad format as per your need. Possible options are Banner, Interstitial and Rewarded.

4. Set the desired parameters in the next tab.

5. On “Add Ad Unit” option under “Ad Unit“, select the ad unit that needs to be targeted with mediation.

6. Under “Ad sources“, click on “ADD CUSTOM EVENT

    • Provide Label and your desired eCPM
    • Under “Configure ad units“, provide the class name details:
      • For Banner Ads: SMAAdMobSmaatoBannerAdapter
      • For Interstitial Ads: SMAAdMobSmaatoInterstitialAdapter
      • For Rewarded Video Ads: SMAAdMobSmaatoRewardedVideoAdapter
    • Pass parameter for the SPX Adspace ID:
      • adSpaceId=<YOUR_SPX_ADSPACE_ID>

SDK Integration

With the modular structure of Smaato’s NextGen SDK, you can select different integration options. The following are configuration examples for your project Podfile:

Banner Ads (with Rich Media support)

pod 'smaato-ios-sdk/Banner'
pod 'smaato-ios-sdk/Adapters/AdMob/Banner'

Interstitial Ads (with Rich Media & Video support)

pod 'smaato-ios-sdk/Interstitial'
pod 'smaato-ios-sdk/Adapters/AdMob/Interstitial'

Rewarded Video Ads

pod 'smaato-ios-sdk/RewardedAds'
pod 'smaato-ios-sdk/Adapters/AdMob/RewardedAds'

Interstitial Ads (Rich Media only)

pod 'smaato-ios-sdk/Modules/Interstitial'
pod 'smaato-ios-sdk/Modules/RichMedia'
pod 'smaato-ios-sdk/Adapters/AdMob/Interstitial'

SDK Initialization

Objective-C Code

// AppDelegate.m 
#import "AppDelegate.h"
@import SmaatoSDKCore; // Import SmaatoSDKCore 
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // initialize SDK first!    
    SMAConfiguration *config = [[SMAConfiguration alloc] initWithPublisherId:@"<SMAATO_PUBLISHER_ID>"];
    config.httpsOnly = YES;               // allow HTTPS traffic only    
    config.logLevel = kSMALogLevelError;  // log errors only
	config.maxAdContentRating = kSMAMaxAdContentRatingUndefined; // ads content restriction based on age
    [SmaatoSDK initSDKWithConfig:config];
    SmaatoSDK.gpsEnabled = YES; // allow the Smaato SDK to automatically get the user's location and put it inside the ad request
    // optional configuration    
    SmaatoSDK.userGender = kSMAGenderFemale;
    SmaatoSDK.userAge = @30;
    SmaatoSDK.userSearchQuery = @"yoga, vegan, san+francisco";
    return YES;

Swift Code

// AppDelegate.swift 
import UIKit
import SmaatoSDKCore
class AppDelegate: UIResponder, UIApplicationDelegate {  
    var window: UIWindow?
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // initialize SDK first!        
        guard let config = SMAConfiguration(publisherId: "<SMAATO_PUBLISHER_ID>") else {
              fatalError("SDK config is nil!")
        config.httpsOnly = true   // allow HTTPS traffic only        
        config.logLevel = .error  // log errors only
		config.maxAdContentRating = .undefined // ads content restriction based on age
        SmaatoSDK.gpsEnabled = true // allow the Smaato SDK to automatically get the user's location and put it inside the ad request
        // optional configuration        
        SmaatoSDK.userGender = .male
        SmaatoSDK.userAge = 40
        SmaatoSDK.userSearchQuery = "bitcoin, lamborghini, san+francisco"
        return true

Important Note: Starting from NextGen SDK version 21.2.1, the new GPSEnabled flag allows the SDK to automatically get the user’s location when permission is given by the user. By default, this flag is set to off and the user location will not be provided in the ad request. To enable this the GPSEnabled flag must be set to yes (for objective-c) or true (for swift).

Modified: January 28, 2020 at 5:42 pm