Integrate Third-Party Ad Networks

The MoPub SDK can mediate most ad networks through our pre-built adapters, and custom events. To see the latest list of supported ad networks, and to get the latest certified versions of mediation adapters, visit the MoPub Mediation Integration Tool. The tool also provides a convenient integration approach, discussed below.

This guide walks you through the mediation setup process, specifically where to download adapters and how to integrate them into your app project.

Integrate adapters via CocoaPods

MoPub Mediation Integration Tool provides a new and convenient integration approach. Simply select the ad networks you would like to mediate, and the page will output the pod name information to include in your app. Once your pod is final, simply run pod install to get the latest adapters. If you are getting started with mediation and do not need to tweak anything, this approach will be the most beneficial.

Integrate adapters via source code (GitHub)

If you prefer to manually integrate adapters using the existing process, you can continue to do so. Our mediation adapters have been migrated to a new GitHub repository.

1. Download the mediation adapters

Within the repository, you can find the adapter files grouped by ad networks. Simply clone the entire repository or manually download the adapter files that you would like to use.

2. Add the adapter files to your app project

In your app project, make sure the following directory paths exist (if you are a new publisher, you might not have them). You will need to place the adapter files into the respective directory depending on the ad network(s) you would like to mediate, in the format below:

  • [ad network name]/[adapter files]

For example, to mediate AdColony, add the AdColony .m and .h files (AdColonyInterstitialCustomEvent and AdColonyRewardedVideoCustomEvent) to an AdColony directory.

IMPORTANT: The FacebookNativeAdAdapter makes use of MPNativeAdAdapterDelegate. Make sure you implement this delegate in your code.

IMPORTANT: If you are using Manual Reference Counting, you’ll need to set the -fobjc-arc compiler flag on these files. Follow the instructions here.

3. Import third-party SDKs

Incorporate the third party SDKs into your project. This information can usually be found on the ad network’s support page.

4. You are all set!

That’s it! Be sure to visit the MoPub dashboard to set up the corresponding network campaigns and target the proper ad units. For additional network tips, take a look at our Mediation > Ad Networks sections.

(Native Ad) Set up your ad renderers

If native ad is among the formats you are mediating, to ensure your native ad views are laid out as intended, create and register the appropriate renderer (if required) for each ad network. Please refer to Mediation > Ad Networks for more nuances. Don’t forget the default MPStaticNativeAdRenderer, shown below.

  • For MoPub renderer:
MPNativeAdRendererConfiguration *mopubConfiguration =

  [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];
  • For third-party ad networks’ renderer. Below is the code snippet for Google’s ad renderer:
MPNativeAdRendererConfiguration *googleConfiguration =

  [MPGoogleAdMobNativeRenderer rendererConfigurationWithRendererSettings:settings];
  • Starting with the 5.2.0 release of the Facebook Audience Network SDK, you have the option to simplify your ad layout by using a pre-defined template provided by Facebook. You won’t need to use a custom layout. Simply pass your MPStaticNativeAdRendererSettings to the FacebookNativeAdRenderer’s rendererConfigurationWithRendererSettings: call, and register that configuration with the ad request (FacebookNativeAdRenderer is a new adapter class introduced in the release):
MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
MPNativeAdRendererConfiguration *config = [FacebookNativeAdRenderer rendererConfigurationWithRendererSettings:settings];

MPNativeAdRequest *adRequest = [MPNativeAdRequest requestWithAdUnitIdentifier:@"YOUR_AD_UNIT_ID" rendererConfigurations:@[config]];

Note: Publishers are encouraged to use the FacebookNativeAdRenderer from above only with MoPub’s manual native ad integration at the moment because of layout issues integrating with the Ad Placer (MPTableViewAdPlacer, or MPCollectionViewAdPlacer, et al.). You might notice an irregular layout of assets when using the FacebookNativeAdRenderer in conjunction with the MoPub Ad Placer. This behavior has been confirmed by the Facebook Audience Network team.

Then, register your ad renderers, like below.

// MPTableViewAdPlacer
MPTableViewAdPlacer placer = [MPTableViewAdPlacer placerWithTableView:self.tableView viewController:self rendererConfigurations:@[mopubConfiguration, googleConfiguration]];
 self.placer.delegate = self;

// MPCollectionViewAdPlacer
MPCollectionViewAdPlacer placer = [MPCollectionViewAdPlacer placerWithCollectionView:self.collectionView viewController:self rendererConfigurations:@[mopubConfiguration, googleConfiguration]];

// MPNativeAdRequest (Manual Integration)
MPNativeAdRequest adRequest = [MPNativeAdRequest requestWithAdUnitIdentifier:nativeAdId rendererConfigurations:@[mopubConfiguration, googleConfiguration]];

Last updated December 19, 2019

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)