Integrating Third Party Ad Networks
- Integrate adapters via CocoaPods
- Integrate adapters via source code (GitHub)
- (Native Ad) Set up your ad renderers
The MoPub SDK can mediate most ad networks through our pre-built adapters, server-to-server integrations, 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 (
AdColonyRewardedVideoCustomEvent) to an
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 AdMob’s ad renderer:
MPNativeAdRendererConfiguration *googleConfiguration = [MPGoogleAdMobNativeRenderer rendererConfigurationWithRendererSettings:settings];
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 13, 2018
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.
© 2018 MoPub Inc.