Enable AdMob Mediation on iOS

Use this guide to add the Vungle iOS SDK into your app, using AdMob as your main advertising mediation layer. AdMob iOS adapter v6.12.1.0 is compatible with Vungle iOS SDK v6.12.1 and has been tested with Google SDK v9.11.0 using Xcode 14.1. AdMob iOS adapter v6.12.1.0 supports SKAdNetwork 3.0 and AppTrackingTransparency using Xcode 13.0+.

AdMob adapter 6.12.1.0 supports rewarded interstitial ad (bidding and waterfall). Please contact your Liftoff account manager to enable this functionality.

Download AdMob iOS Adapter v6.12.1.0 and Vungle iOS SDK 6.12.1, then add them to your project manually. 

Vungle iOS SDK is also available through CocoaPods. Add the following line in your project's pod file, followed by a quick pod install run, to update the project with the version of Vungle iOS SDK.

pod "VungleSDK-iOS", "6.12.1" 

Before You Begin

  • Set up ad units in the AdMob dashboard.
  • Make sure that your Liftoff/Vungle app ID and placement IDs are created in the Monetize dashboard, and that your Liftoff/Vungle placement IDs are linked to ad units in the AdMob dashboard. Refer to AdMob's integration documentation for detailed steps to set up ad units and link Vungle's placement IDs to the AdMob ad units in the AdMob dashboard.
  • Set up the application with the right Xcode and iOS SDK versions, as detailed in the Vungle iOS integration instructions.

Setup

Before you begin to test the new adapter:

  • Integrate the application with the latest adapter files and Vungle SDK.
  • Update the Google Mobile Ads SDK to the latest version in the project.

SKAdNetwork 3.0 Support for iOS 16

Vungle iOS SDK v6.12.1 supports iOS 16 and SKAdNetwork 3.0. For more information on integrating the ATT Framework, a complete list of SKAdNetworkIDs, and a code snippet to integrate SKAdNetworkIDs to your Info.plist file, refer to our iOS integration instructions.

CCPA

As of July 1, 2020, California Consumer Privacy Act (CCPA) is enforced, and publishers must update to Vungle iOS SDK v6.7.0 and AdMob adapter 6.7.0.0 to comply with CCPA.

To pass CCPA values, call the Vungle SDK API directly. This is the only feature that should be accessed directly through Vungle SDK API. Other optional features should use VungleRouterConfiguration class provided in the adapter.

Use updateCCPAStatus to set the user’s consent status to specify that the user has opted out by passing updateCCPAStatus:VungleCCPADenied. And use getCurrentCCPAStatus to get the current CCPA status for the particular user.

CCPA API

Update CCPAgetCurrentCCPAStatus
- (void)updateCCPAStatus:(VungleCCPAStatus)status;

Sample Code

//To set the user's CCPA status to opt_out:
[[VungleSDK sharedSDK] updateCCPAStatus:VungleCCPADenied];
//To find out what the user's current consent status is: [[VungleSDK sharedSDK] getCurrentCCPAStatus];

Banner Ads

Starting with Vungle SDK v6.5.1, we have expanded support for AdMob’s banner ads and support the following sizes:

Size in points (WxH) Description AdSize constant
320 x 50 Banner 

kGADAdSizeBanner

728x90 IAB leaderboard kGADAdSizeLeaderboard
SCREEN_WIDTH x 32 | 50 | 90  Smart Banner

kGADAdSizeSmartBannerPortrait

300 x 250 Medium Rectangle (MREC)

kGADAdSizeMediumRectangle

Mobile: 320 x 50

Tablet: 728 x 90

Adaptive Banner

GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth

Note that the MREC (300dp x 250dp) format must have its own, separate placement reference ID. An MREC format must be configured as 'MREC' in the Monetize dashboard, as opposed to the way that multiple banner sizes can all be configured under the same placement ID as 'banner'.

To display a banner ad in your application, create an MREC placement in the Monetize dashboard and link this placement to a banner ad unit in the AdMob dashboard.

Presently, Vungle supports banner size 300 x 250, which must be specified as constant ad size kGADAdSizeMediumRectangle in your implementation.

Sample Code:

GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeMediumRectangle];
[self addBannerViewToView:self.bannerView];

Refer to the AdMob integration guide for details about loading, playing, and closing a banner ad.

Multiple Banner Load

Vungle iOS SDK 6.5.x supports the loading of one banner ad for a placement ID at any given time, and one placement ID is mapped to one AdMob ad unit ID. This limits the ability to successfully load subsequent loadAd requests when a banner ad has already been loaded by the Vungle SDK. To overcome this limitation, pass the same AdMob ad unit ID for your banner placement for each banner loadAd, so that the request can fall back to the next ad network in the waterfall when the Vungle SDK already has a banner ad loaded.

Sample code:

VungleAdNetworkExtras *extras1 = [[VungleAdNetworkExtras alloc] init];
GADBannerView *bannerView1 = [[GADBannerView alloc] initWithAdSize:bannerSize];
bannerView1.adUnitID = @"AD_UNIT_ID"

GADRequest *request1 = [GADRequest request];
[request1 registerAdNetworkExtras:extras1];
[bannerView1 loadRequest:request1];

VungleAdNetworkExtras *extras2 = [[VungleAdNetworkExtras alloc] init];
GADBannerView *bannerView2 = [[GADBannerView alloc] initWithAdSize:bannerSize];
bannerView2.adUnitID = @"AD_UNIT_ID_FOR_BANNER"

GADRequest *request2 = [GADRequest request];
[request2 registerAdNetworkExtras:extras2];
[bannerView2 loadRequest:request2];

Rewarded Interstitial Ads

As of AdMob Adapter 6.12.0.0, we support rewarded interstitial ads. This includes publisher and advertiser settings and controls, and reporting. Contact your Liftoff account manager to enable this feature. Rewarded interstitial ads behave as follows:

A user playing a game has just completed a level. While the next level loads, the user is prompted that an ad will begin in a few seconds and the reward for watching the ad is an extra heart. The user has the option to close the ad.

After a few seconds, the ad begins with a countdown informing the user how of the time left until they receive the reward. If the user clicks to exit the ad, a prompt appears, warning them about the loss of the reward. The user must confirm that they want to exit the ad before the ad closes.

Our support for rewarded interstitial ads includes:

  • Skip ad option
  • Ad autostart (for example, after 5 seconds)
  • A close ad screen similar to what is displayed when a user tries to close a rewarded ad
  • An endcard when the video completes

If you opt to create an introduction screen that displays when an ad is about to play, refer to the Google AdMob documentation for rewarded interstitials.

Optional Advanced Settings

IDFV

For Vungle SDK version 6.4 and higher, you can now restrict the SDK from passing the IDFV from the device to the SDK.

Sample Code:

//Set the bool value YES to pass the IDFV from device to SDK
[VungleRouterConfiguration setPublishIDFV:YES];
//Set the bool value NO to disable the IDFV collection from device to SDK [VungleRouterConfiguration setPublishIDFV:NO];

Memory Settings

Starting with Vungle SDK v6.4.x, you can prevent the SDK from requesting ads or even initializing if the storage of your iPhone falls below a predefined threshold. 

Sample Code:


//Integer value sets the required minimum available free storage space to be able to initialize the SDK
 [VungleRouterConfiguration setMinSpaceForInit:];
//Integer value sets the required minimum available free storage space to be able to request an Ad [VungleRouterConfiguration setMinSpaceForAdLoad:];

 

New Rewarded API

As documented by AdMob, starting with version 7.42.2 and higher, AdMob’s rewarded ads let you cache multiple ads at the same time for a single ad unit.

Because Vungle does not support this feature, the ad request for the second “Load ad” cannot be filled by Vungle; rather, it is passed to the next ad network in the waterfall.

Questions?

Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?