See About AdMob Mediation for a walk-through of what mediation is and how to use the AdMob Mediation UI. Then, continue reading these instructions for adding mediation code to your app.

Add mediation adapters to your project

1. Integrate AdMob ads

Follow the same instructions used for integrating AdMob ads into your app. To integrate non-interstitial ads (banner size, leaderboard size, and so on), see Banner Ads. To integrate interstitial ads (full-screen ads that mask all other content), see Interstitial Ads.

Once you've completed these integration steps, you'll make a few small modifications described below to change your AdMob ad placement into a mediation placement that can show ads from multiple networks.

2. Add network adapters and SDKs

You're now ready to download and add to your project the adapters and SDKs of all the ad networks you'd like to serve ads from. To find links to them, see Mediation Networks.

To add the downloaded network adapters/SDKs in Xcode, right-click on your project and click Add Files to project.

3. Include network configurations

You need to include any frameworks, compiler flags, or linker flags that your chosen networks require. For your convenience, the mediation networks page has links to each network's instructions.

There is no need to write additional code to create ad views from each ad network. Mediation invokes each ad network's adapter and SDK as necessary to create ads. Below, you can see how to set up mediation listeners that notify you of ad events for all of your networks.

That's it!

Optional setup

Specify additional request parameters

You can optionally add targeting information (such as location, birthday, gender, and COPPA preferences) that can be used by networks to serve more finely targeted ads.

Location targeting

If your app already uses CoreLocation, you can use your existing CLLocationManager instance to set the precise location.


GADRequest *request = [GADRequest request];
CLLocation *currentLocation = locationManager.location;
if (currentLocation) {
  [request setLocationWithLatitude:currentLocation.coordinate.latitude


let request = GADRequest()
if let currentLocation = locationManager.location {
      longitude: CGFloat(currentLocation.coordinate.longitude),
      accuracy: CGFloat(currentLocation.horizontalAccuracy))

Out of respect for user privacy, Google asks that you only specify location if that information is already used by your app.

Besides location, you can also target on birthday and gender, as well as set COPPA tags.

Demographic targeting

GADRequest provides methods for setting birthday and location, and a property for setting gender. These parameters are forwarded to all networks that you mediate. Here is an example:


GADRequest *request = [GADRequest request];
request.gender = kGADGenderFemale;
NSDateComponents *components = [[NSDateComponents alloc] init];
components.month = 1; = 1;
components.year = 1985;
request.birthday = [[NSCalendar currentCalendar] dateFromComponents:components];


let request = GADRequest()
request.gender = .female
var components = DateComponents()
components.month = 1 = 1
components.year = 1985
request.birthday = components)

Network-specific parameters

Some networks also support other request parameters that are specific to their network. These are not required but can be used by networks to serve more finely targeted ads. Ad networks with extra parameters expose a class in their adapter that extends GADExtras.

Let's say there is a sample ad network that exposes an income parameter. That ad network may provide a class that looks like this:


@interface SampleExtras : GADExtras

  @property(nonatomic, assign) NSInteger income;



class SampleExtras: GADExtras {
  var income = 0

If you're mediating this network, you can provide the income to that particular network by passing an instance of their extras class to registerAdNetworkExtras::


SampleExtras *sampleExtras = [[SampleExtras alloc] init];
sampleExtras.income = 65000;
[request registerAdNetworkExtras:sampleExtras];


let sampleExtras = SampleExtras()
sampleExtras.income = 65000

Request agent (for third-party libraries)

Third-party libraries that reference the Mobile Ads SDK should call the setRequestAgent: method to denote the platform from which the ad request originated. For example, if a third-party ad network called "Cool Ad Network" mediates requests to the Mobile Ads SDK and wants to tag its requests for Analytics purposes, it can do so like this:


GADRequest *request = [GADRequest request];
request.requestAgent = @"Cool Ad Network"


let request = GADRequest()
request.requestAgent = "Cool Ad Network"

Set up event notification

To be notified of ad lifecycle events like impressions, you can implement a GADBannerViewDelegate. When using AdMob Mediation, this delegate is notified of events from all the networks you're mediating. For example, impressions from any ad network are reported through the GADBannerViewDelegate method adViewDidReceiveAd:.

See the Ad Events guide for instructions on how to register for ad events.

Check the value of adNetworkClassName

You can optionally check the adNetworkClassName property of GADBannerView, which returns the class name of the ad network that fetched the current banner. This property can be checked once adViewDidReceiveAd is called:


- (void)adViewDidReceiveAd:(GADBannerView *)bannerView {
  NSLog(@"Banner adapter class name: %@", bannerView.adNetworkClassName);


func adViewDidReceiveAd(_ bannerView: GADBannerView) {
  print("Banner adapter class name: \(bannerView.adNetworkClassName)")

Similarly, the adNetworkClassName property of GADInterstitial can be checked once interstitialDidReceiveAd is called:


- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
  NSLog(@"Interstitial adapter class name: %@", interstitial.adNetworkClassName);


func interstitialDidReceiveAd(_ ad: GADInterstitial) {
  print("Interstitial adapter class name: \(ad.adNetworkClassName)")

For ads returned from AdMob, adNetworkClassName returns GADMAdapterGoogleAdMobAds. For ads fetched via custom events, it returns GADMAdapterCustomEvents.

Native Ads Advanced mediation

The Mobile Ads SDK allows you to use mediation to load native ads as well as banner and interstitial ads. On receiving one of these ads from a mediated network, the Mobile Ads SDK maps its assets to one of its two system-defined native ad formats (app install or content ad) before returning it to you. This means that, in general, you can write a single section of code to handle displaying native ad assets from multiple networks.

Because native ads provide you so much freedom, there are a few extra things to consider when using mediation, such as how to handle optional and extra assets, which formats to request, and the importance of ensuring the native ad presentation conforms to the mediated networks' policies.

Note: Mediation Networks provides a list of all the networks currently certified for use in mediation.

Request both system-defined formats

The Mobile Ads SDK allows you to specify a preference for app install ads, content ads, or both for each request. However, not every mediated network offers both of these formats, and some are unable to filter by format. In order to make sure that ad requests have the best chance of being filled, it's highly recommended that apps request both formats when loading native ads and include rendering code that can display either one.

Optional assets

Native ads advanced field descriptions lists the assets that go with each system-defined native ad format available from the Mobile Ads SDK. When using mediation, it's particularly important to be aware that some of these fields are included in every native ad, while others are optional. For example, some mediated SDKs may include a price asset with their app install ads while others do not, and so on.

It's a good idea to check the list of assets for each system-defined native ad format and make sure your app properly accounts for those that aren't always included. For example, here's a code snippet from an adLoader:didReceiveNativeAppInstallAd: delegate method that checks to see if the price asset is present in a GADNativeAppInstallAd object and shows or hides the corresponding asset view as appropriate:

if (nativeAppInstallAd.price) {
  ((UILabel *)appInstallAdView.priceView).text = nativeAppInstallAd.price;
  appInstallAdView.priceView.hidden = NO;
} else {
  appInstallAdView.priceView.hidden = YES;

Extra assets

Some mediated networks may provide assets beyond those normally included by the Mobile Ads SDK (such as an image asset for an AdChoices icon). In order to make sure these additional assets are available to you, the SDK exposes them in an NSDictionary property called extraAssets.

For example, if a mediated network included a "category" string asset in its app install ads, the code to retrieve the asset would look like this:

NSString *category = nativeAppInstallAd.extraAssets["CATEGORY_KEY"];

The names of the keys used to retrieve assets from the extraAssets property vary by ad network ("CATEGORY_KEY" is just an example). Check the documentation provided with the adapter for details.

Native ad options

The Mobile Ads SDK provides subclasses of GADAdLoaderOptions (such as GADNativeAdImageAdLoaderOptions) so that you can specify preferences for how native ads should be delivered. This includes things like the automatic downloading of images, preferred orientation, and other details. This information is given to mediated networks as part of the mediation process. However, not every ad network's SDK is able to abide by all of these options. We recommend that you rigorously test your applications with mediated ads from each network to ensure stability.

One example of this is the disableImageLoading option. Normally, if this is set to true, the Mobile Ads SDK does not automatically download image assets for the ads, and instead returns just the URLs that point to them. If a mediated SDK always downloads images automatically, though, it would be wasteful for the adapter to discard them (only to have the application download them again itself). So in this situation, the adapter always returns image assets regardless of the value of disableImageLoading.

Check the documentation provided with individual mediation adapters for details on which options are supported by that network.

Native ad presentation policy

Each ad network has its own policies. When using mediation, it's important to remember that your app still needs to abide by the polices of the mediated network that provided the ad.


The Mobile Ads SDK automatically places the AdChoices logo for you. Mediation adapters are also responsible for placing the AdChoices logo if applicable, so you don't need to take any action to display an AdChoices asset in their app.


What if I want to mediate with a network, but there is no supported adapter for it?
You can write your own mediation adapters using Custom Events.
Does GADBannerViewDelegate still work with mediation?
Yes, it still works with all mediation networks.
I want to add a new network to my mediation configuration for the next version of my app. How will that affect the current version of my app that doesn't include this network?
The SDK detects when an adapter isn't there and fails gracefully; the request then goes to the next network in the mediation waterfall.
What does the "<Google> Cannot find an ad network adapter with the name(s): (GADMSomeAdapter)" error message mean?
Your project is likely missing the adapter library that contains this class. You need to add network adapters and SDKs for all ad networks you're mediating.

Send feedback about...

AdMob by Google
AdMob by Google