You can download and integrate the MAX mediation adapters into your app in two ways:
CocoaPods
AppLovin recommends that you integrate adapters this way.
AppLovin’s adapters’ pods automatically integrate the mediated network’s SDK and its dependencies.
Open Source Adapters
If you require more flexibility in the integration, you can integrate AppLovin’s open source adapters.
You are responsible for integrating the mediated SDKs and any dependencies they require.
You can find these adapters in the AppLovin-MAX-SDK-iOS GitHub repository .
CocoaPods
Choose which mediated ad networks you want to integrate by checking the boxes below.
Then this page displays instructions specific to those networks.
This page also customizes a CocoaPods script for you.
Copy the customized CocoaPods script below to your Podfile.
target ' YOUR_PROJECT_NAME ' do
pod ' AmazonPublisherServicesSDK '
pod ' AppLovinMediationAmazonAdMarketplaceAdapter '
pod ' AppLovinMediationBidMachineAdapter '
pod ' AppLovinMediationBigoAdsAdapter '
pod ' AppLovinMediationChartboostAdapter '
pod ' AppLovinMediationCSJAdapter '
pod ' AppLovinMediationFyberAdapter '
pod ' AppLovinMediationGoogleAdManagerAdapter '
pod ' AppLovinMediationGoogleAdapter '
pod ' AppLovinMediationHyprMXAdapter '
pod ' AppLovinMediationInMobiAdapter '
pod ' AppLovinMediationIronSourceAdapter '
pod ' AppLovinMediationVungleAdapter '
pod ' AppLovinMediationLineAdapter '
pod ' AppLovinMediationMaioAdapter '
pod ' AppLovinMediationFacebookAdapter '
pod ' AppLovinMediationMintegralAdapter '
pod ' AppLovinMediationMobileFuseAdapter '
pod ' AppLovinMediationMolocoAdapter '
pod ' AppLovinMediationOguryPresageAdapter '
pod ' AppLovinMediationByteDanceAdapter '
pod ' AppLovinMediationPubMaticAdapter '
pod ' AppLovinMediationSmaatoAdapter '
pod ' AppLovinMediationTencentGDTAdapter '
pod ' AppLovinMediationUnityAdsAdapter '
pod ' AppLovinMediationVerveAdapter '
pod ' AppLovinMediationMyTargetAdapter '
pod ' AppLovinMediationYandexAdapter '
pod ' AppLovinMediationYSONetworkAdapter '
Note
Starting from Pangle iOS adapter version 4.9.1.0.0, Pangle is no longer available in Chinese Mainland.
To monetize Chinese Mainland traffic, set up the CSJ network and add the CSJ adapter.
For global traffic that excludes Chinese Mainland, you can continue to use Pangle for monetization.
Swift Build Settings
To support Swift for iOS versions below 12.2:
In the main target of your Xcode project select File > Build Settings .
Set Always Embed Swift Standard Libraries to Yes .
App Delegate window
Property
Do not remove the window
property of your App Delegate file.
If you do so, InMobi’s SDK may crash.
@ property (nonatomic, strong) UIWindow * window;
Meta Audience Network Data Processing Options
If you do not want to enable Limited Data Use (LDU) mode, pass SetDataProcessingOptions()
an empty array:
#import < FBAudienceNetwork/FBAudienceNetwork.h >
[FBAdSettings setDataProcessingOptions : @[] ];
FBAdSettings. setDataProcessingOptions ( [] )
To enable LDU for users and to specify user geography, call SetDataProcessingOptions()
like this:
#import < FBAudienceNetwork/FBAudienceNetwork.h >
[FBAdSettings setDataProcessingOptions : @[ @" LDU " ] country : «country» state : «state» ];
FBAdSettings. setDataProcessingOptions ( [ " LDU " ], country : « country » , state : « state » )
Using Google UMP
If you use Google UMP as your CMP, you can determine whether the user has consented to Meta or not.
To do so, use code like the following:
NSNumber * hasMetaConsent = [ALPrivacySettings additionalConsentStatusForIdentifier : 89 ];
BOOL consentGiven = hasMetaConsent.boolValue;
// Set Meta Data Processing Options accordingly.
// AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
let hasMetaConsent = ALPrivacySetting. additionalConsentStatus ( forIdentifier : 89 )
if let consentGiven = hasMetaConsent ? .boolValue
// Set Meta Data Processing Options accordingly.
// AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
Meta Audience Network Data Processing Options for Users in California
To learn how to implement Meta Audience Network’s “Limited Data Use” flag in California, read the Meta for Developers documentation .
Meta Preparing for iOS 14.5 and Above
Audience Network SDK 6.2.1 was released on January 11, 2021.
This version has these important requirements:
Implement the setAdvertiserTrackingEnabled
flag, irrespective of the use of mediation.
This informs Meta whether it can use the data to deliver personalized ads.
Add the SKAdNetwork IDs that Meta suggests to the Xcode project’s Info.plist
so that advertisers can measure the success of ad campaigns.
Refer to the SKAdNetwork documentation for integration instructions.
[sdk initializeSdkWithCompletionHandler : ^ (ALSdkConfiguration * sdkConfiguration)
if ( @available(iOS 14.5 , * ) )
// Note that App transparency tracking authorization can be checked via `sdkConfiguration.appTrackingTransparencyStatus`
// 1. Set Meta ATE flag here, THEN
sdk. initializeSdk { ( sdkConfiguration : ALSdkConfiguration) in
if #available ( iOS 14.5 , * )
// Note that App transparency tracking authorization can be checked via `sdkConfiguration.appTrackingTransparencyStatus`
// 1. Set Meta ATE flag here, THEN
Note
Developers and publishers who use Google AdSense, AdManager, or AdMob must use a consent management platform (CMP) that is certified by Google.
The CMP must integrate with IAB’s Transparency and Consent Framework when you serve ads to users in the European Economic Area (EEA) or the UK.
See Privacy: “TCF v2 Consent” for more information.
Add Your Google Bidding and Google AdMob / Google Ad Manager App ID
In your app’s Info.plist
, add a GADApplicationIdentifier
key.
Give this key the String value of your Google bidding and Google AdMob / Google Ad Manager App ID.
Initialize the Amazon SDK
The Amazon Publisher Services SDK requires that you initialize it outside of MAX SDK:
[[DTBAds sharedInstance ] setAppKey : appId ];
DTBAdNetworkInfo * adNetworkInfo = [[DTBAdNetworkInfo alloc ] initWithNetworkName : DTBADNETWORK_MAX ];
[DTBAds sharedInstance ].mraidCustomVersions = @[ @" 1.0 " , @" 2.0 " , @" 3.0 " ];
[[DTBAds sharedInstance ] setAdNetworkInfo : adNetworkInfo ];
[DTBAds sharedInstance ].mraidPolicy = CUSTOM_MRAID;
Load a Banner or MREC Ad from Amazon’s SDK
To integrate Amazon ads into MAX, you must load the Amazon ad first.
Before you load the MAX ad, pass the DTBAdResponse
or DTBAdErrorInfo
into the instance of MAAdView
.
You can do this by calling -[MAAdView setLocalExtraParameterForKey:value:]
.
@interface ExampleViewController ()<DTBAdCallback>
@implementation ExampleViewController
NSString * amazonAdSlotId;
if ( UIDevice . currentDevice . userInterfaceIdiom == UIUserInterfaceIdiomPad )
amazonAdSlotId = @" «Amazon-leader-slot-ID» " ;
adFormat = MAAdFormat . leader ;
amazonAdSlotId = @" «Amazon-banner-slot-ID» " ;
adFormat = MAAdFormat . banner ;
CGSize rawSize = adFormat . size ;
DTBAdSize * size = [[DTBAdSize alloc ] initBannerAdSizeWithWidth : rawSize.width
andSlotUUID : amazonAdSlotId ];
DTBAdLoader * adLoader = [[DTBAdLoader alloc ] init ];
[adLoader setAdSizes : @[size] ];
- ( void ) onSuccess : (DTBAdResponse * ) adResponse
// 'adView' is your instance of MAAdView
[ self .adView setLocalExtraParameterForKey : @" amazon_ad_response " value : adResponse ];
- ( void ) onFailure : (DTBAdError) error dtbAdErrorInfo : (DTBAdErrorInfo * ) errorInfo
// 'adView' is your instance of MAAdView
[ self .adView setLocalExtraParameterForKey : @" amazon_ad_error " value : errorInfo ];
class ExampleViewController: UIViewController
override func viewDidLoad ()
let amazonAdSlotId: String
if UIDevice.current.userInterfaceIdiom == .pad
amazonAdSlotId = " «Amazon-leader-slot-ID» "
adFormat = MAAdFormat. leader
amazonAdSlotId = " «Amazon-banner-slot-ID» "
adFormat = MAAdFormat. banner
let rawSize = adFormat.size
let size = DTBAdSize ( bannerAdSizeWithWidth : Int ( rawSize. width ) ,
height : Int ( rawSize. height ) ,
andSlotUUID : amazonAdSlotId ) !
let adLoader = DTBAdLoader ()
adLoader. setAdSizes ( [size] )
extension ExampleViewController: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_error " , value :dtbAdErrorInfo )
struct ExampleSwiftUIWrapper: UIViewRepresentable
func makeUIView ( context : Context ) -> MAAdView
let adView = MAAdView ( adUnitIdentifier : " «ad-unit-ID» " )
adView. delegate = context. coordinator
let amazonAdSlotId: String
if UIDevice.current.userInterfaceIdiom == .pad
amazonAdSlotId = " «Amazon-leader-slot-ID» "
adFormat = MAAdFormat. leader
amazonAdSlotId = " «Amazon-banner-slot-ID» "
adFormat = MAAdFormat. banner
let rawSize = adFormat.size
let size = DTBAdSize ( bannerAdSizeWithWidth : Int ( rawSize. width ) ,
height : Int ( rawSize. height ) ,
andSlotUUID : amazonAdSlotId ) !
let adLoader = DTBAdLoader ()
adLoader. setAdSizes ( [size] )
extension ExampleSwiftUIWrapper
class Coordinator: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_error " , value : dtbAdErrorInfo )
@interface ExampleViewController ()<DTBAdCallback>
@implementation ExampleViewController
NSString * amazonAdSlotId;
DTBAdLoader * adLoader = [[DTBAdLoader alloc ] init ];
[adLoader setAdSizes : [[DTBAdSize alloc ] initBannerAdSizeWithWidth : 300
andSlotUUID : amazonAdSlotId] ];
- ( void ) onSuccess : (DTBAdResponse * ) adResponse
// 'adView' is your instance of MAAdView
[ self .adView setLocalExtraParameterForKey : @" amazon_ad_response " value : adResponse ];
- ( void ) onFailure : (DTBAdError) error dtbAdErrorInfo : (DTBAdErrorInfo * ) errorInfo
// 'adView' is your instance of MAAdView
[ self .adView setLocalExtraParameterForKey : @" amazon_ad_error " value : errorInfo ];
class ExampleViewController: UIViewController
override func viewDidLoad ()
let amazonAdSlotId: String
let adLoader = DTBAdLoader ()
adLoader. setAdSizes ( [ DTBAdSize ( bannerAdSizeWithWidth : 300 ,
andSlotUUID : amazonAdSlotId ) ! ] )
extension ExampleViewController: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_error " , value :dtbAdErrorInfo )
struct ExampleSwiftUIWrapper: UIViewRepresentable
func makeUIView ( context : Context ) -> MAAdView
let adView = MAAdView ( adUnitIdentifier : " «ad-unit-ID» " , adFormat : MAAdFormat. mrec )
adView. delegate = context. coordinator
let amazonAdSlotId: String
let adLoader = DTBAdLoader ()
adLoader. setAdSizes ( [ DTBAdSize ( bannerAdSizeWithWidth : 300 ,
andSlotUUID : amazonAdSlotId ) ! ] )
extension ExampleSwiftUIWrapper
class Coordinator: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'adView' is your instance of MAAdView
adView. setLocalExtraParameterForKey ( " amazon_ad_error " , value : dtbAdErrorInfo )
Load an Interstitial Ad from Amazon’s SDK
To integrate Amazon interstitial ads into MAX, you must load the Amazon ad first.
Before you load the MAX ad, pass the DTBAdResponse
or DTBAdErrorInfo
into the instance of MAInterstitialAd
.
You can do this by calling -[MAInterstitialAd setLocalExtraParameterForKey:value:]
.
#import < AppLovinSDK/AppLovinSDK.h >
#import < DTBiOSSDK/DTBiOSSDK.h >
@interface ExampleViewController ()<DTBAdCallback>
@implementation ExampleViewController
static MAInterstitialAd * interstitialAd;
interstitialAd = [[MAInterstitialAd alloc ] initWithAdUnitIdentifier : @" «MAX-inter-ad-unit-ID» " ];
// If first load - load ad from Amazon's SDK, then load ad for MAX
DTBAdLoader * adLoader = [[DTBAdLoader alloc ] init ];
[[DTBAdSize alloc ] initInterstitialAdSizeWithSlotUUID : @" «Amazon-inter-slot-ID» " ]
- ( void ) onSuccess : (DTBAdResponse * ) adResponse
// 'interstitialAd' is your instance of MAInterstitialAd
[interstitialAd setLocalExtraParameterForKey : @" amazon_ad_response " value : adResponse ];
- ( void ) onFailure : (DTBAdError) error dtbAdErrorInfo : (DTBAdErrorInfo * ) errorInfo
// 'interstitialAd' is your instance of MAInterstitialAd
[interstitialAd setLocalExtraParameterForKey : @" amazon_ad_error " value : errorInfo ];
class ExampleViewController: UIViewController
private static var interstitialAd = MAInterstitialAd ( adUnitIdentifier : " «MAX-inter-ad-unit-ID» " )
private static var isFirstLoad = true
// If first load - load ad from Amazon's SDK, then load ad for MAX
let adLoader = DTBAdLoader ()
adLoader. setAdSizes ( [ DTBAdSize ( interstitialAdSizeWithSlotUUID : " «Amazon-inter-slot-ID» " ) ! ] )
Self . interstitialAd . load ()
extension ExampleViewController: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'interstitialAd' is your instance of MAInterstitialAd
Self . interstitialAd . setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
Self . interstitialAd . load ()
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'interstitialAd' is your instance of MAInterstitialAd
Self . interstitialAd . setLocalExtraParameterForKey ( " amazon_ad_error " , value : dtbAdErrorInfo )
Self . interstitialAd . load ()
Load a Video Interstitial Ad from Amazon’s SDK
To integrate Amazon interstitial ads into MAX, you must load the Amazon ad first.
Before you load the MAX ad, pass the DTBAdResponse
or DTBAdErrorInfo
into the instance of MAInterstitialAd
.
You can do this by calling -[MAInterstitialAd setLocalExtraParameterForKey:value:]
#import < AppLovinSDK/AppLovinSDK.h >
#import < DTBiOSSDK/DTBiOSSDK.h >
@interface ExampleViewController ()<DTBAdCallback>
@implementation ExampleViewController
static MAInterstitialAd * interstitialAd;
interstitialAd = [[MAInterstitialAd alloc ] initWithAdUnitIdentifier : @" «MAX-inter-ad-unit-ID» " ];
// If first load - load ad from Amazon's SDK, then load ad for MAX
DTBAdLoader * adLoader = [[DTBAdLoader alloc ] init ];
// Switch video player width and height values(320, 480) depending on device orientation
[[DTBAdSize alloc ] initVideoAdSizeWithPlayerWidth : 320 height : 480 andSlotUUID : @" «Amazon-video-inter-slot-ID» " ]
- ( void ) onSuccess : (DTBAdResponse * ) adResponse
// 'interstitialAd' is your instance of MAInterstitialAd
[interstitialAd setLocalExtraParameterForKey : @" amazon_ad_response " value : adResponse ];
- ( void ) onFailure : (DTBAdError) error dtbAdErrorInfo : (DTBAdErrorInfo * ) errorInfo
// 'interstitialAd' is your instance of MAInterstitialAd
[interstitialAd setLocalExtraParameterForKey : @" amazon_ad_error " value : errorInfo ];
class ExampleViewController: UIViewController
private static var interstitialAd = MAInterstitialAd ( adUnitIdentifier : " «MAX-inter-ad-unit-ID» " )
private static var isFirstLoad = true
// If first load - load ad from Amazon's SDK, then load ad for MAX
let adLoader = DTBAdLoader ()
// Switch video player width and height values(320, 480) depending on device orientation
adLoader. setAdSizes ( [ DTBAdSize ( videoAdSizeWithPlayerWidth : 320 , height : 480 , andSlotUUID : " «Amazon-video-inter-slot-ID» " ) ! ] )
Self . interstitialAd . load ()
extension ExampleViewController: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'interstitialAd' is your instance of MAInterstitialAd
Self . interstitialAd . setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
Self . interstitialAd . load ()
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'interstitialAd' is your instance of MAInterstitialAd
Self . interstitialAd . setLocalExtraParameterForKey ( " amazon_ad_error " , value : dtbAdErrorInfo )
Self . interstitialAd . load ()
Load a Rewarded Video Ad from Amazon’s SDK
To integrate Amazon rewarded videos into MAX, you must load the Amazon ad first.
Before you load the MAX ad, pass the DTBAdResponse
or DTBAdErrorInfo
into the instance of MARewardedAd
.
You can do this by calling -[MARewardedAd setLocalExtraParameterForKey:value:]
.
#import < AppLovinSDK/AppLovinSDK.h >
#import < DTBiOSSDK/DTBiOSSDK.h >
@interface ExampleViewController ()<DTBAdCallback>
@implementation ExampleViewController
static MARewardedAd * rewardedAd;
rewardedAd = [MARewardedAd sharedWithAdUnitIdentifier : @" «MAX-rewarded-ad-unit-ID» " ];
// If first load - load ad from Amazon's SDK, then load ad for MAX
DTBAdLoader * adLoader = [[DTBAdLoader alloc ] init ];
// Switch video player width and height values(320, 480) depending on device orientation
[[DTBAdSize alloc ] initVideoAdSizeWithPlayerWidth : 320 height : 480 andSlotUUID : @" «Amazon-video-rewarded-slot-ID» " ]
- ( void ) onSuccess : (DTBAdResponse * ) adResponse
// 'rewardedAd' is your instance of MARewardedAd
[rewardedAd setLocalExtraParameterForKey : @" amazon_ad_response " value : adResponse ];
- ( void ) onFailure : (DTBAdError) error dtbAdErrorInfo : (DTBAdErrorInfo * ) errorInfo
// 'rewardedAd' is your instance of MARewardedAd
[rewardedAd setLocalExtraParameterForKey : @" amazon_ad_error " value : errorInfo ];
class ExampleViewController: UIViewController
private static var rewardedAd = MARewardedAd. shared ( withAdUnitIdentifier : " «MAX-rewarded-ad-unit-ID» " )
private static var isFirstLoad = true
// If first load - load ad from Amazon's SDK, then load ad for MAX
let adLoader = DTBAdLoader ()
// Switch video player width and height values(320, 480) depending on device orientation
adLoader. setAdSizes ( [ DTBAdSize ( videoAdSizeWithPlayerWidth : 320 , height : 480 , andSlotUUID : " «Amazon-video-rewarded-slot-ID» " ) ! ] )
extension ExampleViewController: DTBAdCallback
func onSuccess ( _ adResponse : DTBAdResponse ! )
// 'rewardedAd' is your instance of MARewardedAd
Self . rewardedAd . setLocalExtraParameterForKey ( " amazon_ad_response " , value : adResponse )
func onFailure ( _ error : DTBAdError, dtbAdErrorInfo : DTBAdErrorInfo ! )
// 'rewardedAd' is your instance of MARewardedAd
Self . rewardedAd . setLocalExtraParameterForKey ( " amazon_ad_error " , value : dtbAdErrorInfo )
Testing Amazon Publisher Services
AppLovin recommends that you enable test mode for Amazon’s SDK.
When you do this, you receive test ads.
Enable test mode with the following calls:
[[DTBAds sharedInstance ] setLogLevel : DTBLogLevelAll ];
[[DTBAds sharedInstance ] setTestMode : YES ];
DTBAds. sharedInstance (). setLogLevel ( DTBLogLevelAll )
DTBAds. sharedInstance (). testMode = true
You can filter your waterfalls to contain only Amazon ads.
To do this, navigate to Select Live Network in the Mediation Debugger and select the Amazon network.
Disable App Transport Security
To disable App Transport Security (ATS), add NSAppTransportSecurity
to your app’s Info.plist
.
Then add the key NSAllowsArbitraryLoads
and set its Boolean value to YES
.
Make sure this is the only key present.
Install the New Pods
Run the following on the command line.
pod install --repo-update