iOS AdMob Integration

Integration Guide for Publishers with AdMob as a Primary Ad Server

(iOS SDK version 22.9.3)

❗️

Attention:

If you are a publisher that has a custom adapter or intends to have a custom integration, please contact our

Contact Sales Engineering

📘

Smaato’s AdMob adapter for iOS also supports Google Ad Manager (GAM) integrations. Please ask your dedicated Smaato Account Manager for more information.

AdMob Dashboard Setup

  1. Go to the AdMob Dashboard https://apps.admob.com/v2/mediation/groups/list

  2. Click on "Create Mediation Group" button

  3. Select Ad format as per your need. Possible options are Banner, Interstitial, Native, 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
      • For Native Ads: SMAAdMobSmaatoNativeAdapter
    • Pass parameter for the SPX Adspace ID:
      • adSpaceId=<YOUR_SPX_ADSPACE_ID> (e.g. adSpaceId=133149964)

Integrate the NextGen SDK

First, configure your SPX account: https://spx.smaato.com/

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-mediation-admob/Banner'Copy to Clipboard

Interstitial Ads (with Rich Media & Video support)

pod 'smaato-ios-sdk/Interstitial'  
pod 'smaato-ios-sdk-mediation-admob/Interstitial'Copy to Clipboard

Rewarded Video Ads

pod 'smaato-ios-sdk/RewardedAds'
pod 'smaato-ios-sdk-mediation-admob/RewardedAds'

Interstitial Ads (Rich Media only)

pod 'smaato-ios-sdk/Modules/Interstitial'  
pod 'smaato-ios-sdk/Modules/RichMedia'  
pod 'smaato-ios-sdk-mediation-admob/Interstitial'

Native Ads

pod 'smaato-ios-sdk/Native'
pod 'smaato-ios-sdk-mediation-admob/Native'

OR
You can integrate manually with these source code files.

Open Terminal then go to the project directory.

cd {PATH_TO_PROJECT_DIR}

Install the pods.

pod install

Add SKAdNetwork IDs to Info.plist

📘

Important:

If your application is running on iOS 14 and above, it is required to add our demand partners' SKAdNetwork IDs to your Info.plist file in your Xcode project. You can add these IDs with the following steps:

  1. Right click on Info.plist within your Project Navigator in your Xcode project.

  2. Hover over "Open as >" and select "Source Code".

  3. Copy the code below and paste it at the bottom of your Info.plist file (just before the at the bottom).

<key>SKAdNetworkItems</key>  
  <array>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>uw77j35x4d.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>7ug5zh24hu.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>hs6bdukanm.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>3sh42y64q3.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>klf5c3l5u5.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>5l3tpt7t6e.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>yclnxrl5pm.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>wg4vff78zm.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>9rd848q2bz.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>kbd757ywx3.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>ydx93a7ass.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>4pfyvq9l8r.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>2u9pt9hc89.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>c6k4g5qg8m.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>prcb7njmu6.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>cj5566h2ga.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>mls7yz5dvl.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>5a6flpkh64.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>4468km3ulz.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>ejvt5qm6ak.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>578prtvx9j.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>ppxm28t8ap.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>v72qych5uu.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>f73kdq92p3.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>8m87ys6875.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>3rd42ekr43.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>8s468mfl3y.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>7rz58n8ntl.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>488r3q3dtq.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>tl55sbb4fm.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>f38h382jlk.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>zmvfpc5aq8.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>44jx6755aq.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>mlmmfzh3r3.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>97r2b46745.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>m8dbw4sv7c.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>6xzpu9s2p8.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>cg4yq2srnc.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>g28c52eehv.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>52fl2v3hgk.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>pwa73g5rt2.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>9nlqeag3gk.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>p78axxw29g.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>4fzdc2evr5.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>523jb4fst2.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>ggvn48r87g.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>24t9a8vw3c.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>cstr6suwn9.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>wzmmz9fp6w.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>5lm9lj6jb7.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>feyaarzu9v.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>9t245vhmpl.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>n9x2a789qt.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>glqzh8vgby.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>424m5254lk.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>gta9lk7p23.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>5tjdwbrq8w.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>22mmun2rn5.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>mtkv5xtk9e.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>t38b2kh725.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>6g9af3uyq4.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>u679fj5vs4.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>275upjj5gd.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>rx5hdcabgc.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>x44k69ngh6.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>32z4fx6l9h.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>w9q455wk68.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>av6w8kgt66.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>e5fvkxwrpn.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>m5mvw97r93.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>89z7zv988g.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>k674qkevps.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>hb56zgv37p.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>rvh3l7un93.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>mp6xlyr22a.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>qqp299437r.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>b9bk5wbcq9.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>bxvub5ada5.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>kbmxgpxpgc.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>6v7lgmsu45.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>m297p6643m.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>294l99pt4k.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>n6fk4nfna4.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>r45fhb6rf7.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>2fnua5tdw4.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>3l6bd9hu43.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>vcra2ehyfk.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>3qcr597p9d.skadnetwork</string>  
    </dict>  
    <dict>  
      <key>SKAdNetworkIdentifier</key>  
      <string>74b6s63p6l.skadnetwork</string>  
    </dict>  
  </array>

📘

Important Note:

All SKAdNetwork IDs listed in your Info.plist must be lowercased.

📘

Important Note:

More SKAdNetwork IDs may be added to this current list. Please check back periodically for updates.

Initialize the NextGen SDK

In the "AppDelegate.m" import SmaatoSDKCore module and configure SDK in application:didFinishLaunchingWithOptions:"

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

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

📘

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).

Important Details About GDPR

The General Data Protection Regulation (GDPR) was created to provide European users with greater transparency and control over their personal information. As a publisher, you should integrate a Consent Management Platform (CMP) and request for user, vendor, and purpose consents as outlined in IAB Europe’s IAB Tech Lab - CMP API v2. You can find an example implementation of a web-based CMP and the corresponding native wrappers here in the IAB's GDPR-Transparency-and-Consent-Framework.

You can also make your own custom CMP. The collected end-user consent information needs to be stored in NSUserDefaults using the following keys:

Transparency and Consent Framework v2:

KeyTypeDescription
IABTCF_gdprAppliesNSNumber1 = Subject to GDPR
0 = Not subject to GDPR
-1 or unset = Undetermined (default before initialization)
IABTCF_TCStringNSStringBase64-encoded consent string as defined in IAB Tech Lab – Consent string and vendor list formats v2

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.

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 CCPA Saving in NSUserDefaults

// save the user's consent
private func saveCCPA(usPrivacy string: String?) {
    guard let usString = string else {
        return
    }
    UserDefaults.standard.set(usString, forKey: "IABUSPrivacy_String"
}
// call this function like this:
// saveCCPA(string: "1YNN")
// save the user's consent
- (void)saveCCPAUsPrivacyString:(NSString *)usString
{
    if (usString.length > 0) {
        [NSUserDefaults.standardUserDefaults setObject:usString 
         forKey:@"IABUSPrivacy_String"];
    }
}
// call this function like this:
// [saveCCPAUsPrivacyString usString:@"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:

Please review the IAB’s guidelines for entering and formatting the U.S. Privacy String (CCPA Opt-Out Storage Format). Our sample provided above ("1YNN") for the US Privacy String demonstrates when the user has not made a choice to opt-out.

Further Examples of the U.S. Privacy String 1YNN: User has not made a choice to opt-out 1NYY: User has made a choice to opt-out 1---: A Digital Property has determined to use a U.S. Privacy string version 1 and that CCPA does not apply to the transaction.

Ads for Testing Purposes

📘

Important Note:

All ad spaces can be used on both Android and iOS platforms and do not require any SPX changes. It is mandatory to the use the ad space IDs provided in the table below for testing. You can use these ad space IDs without changing your production publisher ID, as long as you move back to your production ad space IDs when publishing your app.

Adspace IDTypeDescription
130626424Rich MediaBanner / Med-rect / Leaderboard / Skyscraper
130635694Static ImageBanner / Med-rect / Leaderboard / Skyscraper
130635706MRAIDBanner / Med-rect / Leaderboard / Skyscraper
130626426Rich MediaVideo Interstitial (Video with an end-card + Rich Media Interstitial for 320x480, 480x320, 1024x768 & 768x1024)
130626427VideoSkippable Video
130626428RewardedRewarded Video
130635048RewardedRewarded Video without an end-card
130783664NativeNative with static image main creative