Early Access - Enable MoPub Mediation on iOS v.6.7.0-early2

Use this guide to add Vungle iOS SDK into your app, using MoPub as your main advertising mediation layer.

Contents:

Before You Begin

Requirements

Integrate the Vungle iOS SDK and the MoPub Adapter Framework

  1. Download the Vungle SDK for iOS here: Vungle iOS SDK v6.7.0-early2.
  2. Follow our integration instructions. 
  3. Follow MoPub's instructions to integrate the Vungle MoPub iOS Adapter Framework 6.7.0.0.

CCPA

As of July 1, 2020, California Consumer Privacy Act (CCPA) will be enforced and publishers must update to iOS SDK 6.7.0-early2 and MoPub adapter 6.7.0.0 to comply with CCPA.

To pass CCPA values, you must 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 VungleAdapterConfiguration 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 CCPA status is:
[[VungleSDK sharedSDK] getCCPAStatus];
    

 

Banner Ad Size

Vungle supports following three banner ad sizes: Banner, Medium rectangle, Leaderboard. Please use an ad container that is no smaller than the specified size and use the corresponding size configuration when requesting banner ads.

Banner Formats Size MoPub Ad Size Configuration
Banner 320dp x 50dp size:MOPUB_BANNER_SIZE
Leaderboard 728dp x 90dp size:MOPUB_LEADERBOARD_SIZE
Medium rectangle 300dp x 250dp size:MOPUB_MEDIUM_RECT_SIZE
     
Flexible Banner 
(more details here)
SCREEN_WIDTH x 50 | 90 | 250 kMPPresetMaxAdSize50Height
kMPPresetMaxAdSize90Height
kMPPresetMaxAdSize250Height

Sample code: 

self.adView = [[MPSampleAppInstanceProvider sharedProvider] buildMPAdViewWithAdUnitID:self.info.ID size:MOPUB_MEDIUM_RECT_SIZE];

Optional Advanced Settings

Early SDK Initialization (Recommended)

MoPub iOS SDK 5.5.0 and above allows you to early initialize ad network SDK when MoPub SDK completes initialization. We strongly recommend you to use this feature as it will allow additional time for Vungle SDK to pre-cache an ad and have it ready to play at display opportunity.

Sample code:

MPMoPubConfiguration * sdkConfig = [[MPMoPubConfiguration alloc]
initWithAdUnitIdForAppInitialization:@"MOPUB_AD_UNIT_WITH_VUNGLE_PLACEMENT"];

NSMutableDictionary *configDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ @"appId" : @"YOUR_VUNGLE_APP_ID" }];
 
[sdkConfig setNetworkConfiguration:configDictionary forMediationAdapter:@"VungleAdapterConfiguration"];

[[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig
   completion:^{
  NSLog(@"SDK initialization complete"); }];

Memory Settings

Starting from v6.4.0, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your iOS device falls below a predefined threshold.

These are the option keys available:

Keys

Type/Value

Description

vngMinSpaceForInit

Integer, value in MB, default value is 50

Sets the required minimum available free storage space to be able to initialize the SDK

vngMinSpaceForAdLoad

Integer, value in MB, default value is 50

Sets the required minimum available free storage space to be able to request an ad

 

Sample code:

NSMutableDictionary *configDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ @"appId" : @"YOUR_VUNGLE_APP_ID" }];

[[NSUserDefaults standardUserDefaults] setValue:@(50) forKey:@"vngMinSpaceForInit"];
[[NSUserDefaults standardUserDefaults] setValue:@(50) forKey:@"vngMinSpaceForAdLoad"];
 
[sdkConfig setNetworkConfiguration:configDictionary forMediationAdapter:@"VungleAdapterConfiguration"];

Restrict Collection of IDFV

Starting with iOS SDK 6.4.3, publishers can now restrict from passing IDFV when Limit Ad Tracking option is enabled on user's devices. Please import VungleRouter.h to access this API and use it in your AppDelegate before Vungle SDK gets initialized.

Sample code:

#import "VungleRouter.h"

// Invoke setShouldCollectDeviceId before initialization of Vungle SDK
[VungleRouter.sharedRouter setShouldCollectDeviceId:NO];

Customize Rewarded Ads

You can use VungleInstanceMediationSettings to customize rewarded ad experience.

These are the option keys available:

Keys

Type/Value

Description

orientations

0 Auto-rotate
1 Landscape
2 Portrait

Sets the orientation of the ad. We recommend allowing ads to auto-rotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

ordinal

Integer

If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in “3”). Read more about ordinal data here.

startMuted YES or NO The Vungle SDK instance offers the option to play ads with the sound disabled. Please contact your account manager to enable it from Vungle dashboard as well.
userIdentifier String Sets your user ID. The value is passed to Vungle server, and then sent to your server through server-to-server callback system if a placement is set to "Rewarded."

 

Customize Interstitial Ads

Starting with MoPub adapter 6.4.5.1, you can use localExtras to pass customization options for interstitial ads.

These are the option keys available:

Keys

Type/Value

Description

orientations

NSNumber

0 Auto-rotate
1 Landscape
2 Portrait

Sets the orientation of the ad. We recommend allowing ads to auto-rotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

ordinal

NSString

If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in “3”). Read more about ordinal data here.

muted

NSNumber

YES or NO

The Vungle SDK instance offers the option to play ads with the sound disabled. Please contact your account manager to enable it from Vungle dashboard as well.

Sample code:

NSNumber *orientations = [NSNumber numberWithInt:1];
NSString *ordinal = @"10";
NSNumber *muted = [NSNumber numberWithBool:YES];

NSDictionary *localExtras = @{@"ordinal" : ordinal ?: @"",
                              @"muted" : muted ?: @"",
                              @"orientations" : orientations ?: @""};
    
self.interstitial.localExtras = localExtras;
Powered by Creativity Driven by Performance Sign Up Here

Questions?

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

Was this article helpful?