Mediation

This guide shows you how to integrate a mediation adapter with your current iOS app and set up additional request parameters.

Prerequisites

Check the value of adNetworkClassName

Each ad format class has an adNetworkClassName property on the GADResponseInfo object that returns the class name of the ad network that fetched the current ad. This property only has a value once an ad successfully loads.

Here is some sample code that logs the ad network class name for each ad format.

Swift

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

Objective-C

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

Interstitial

Swift

func interstitialDidReceiveAd(_ interstitial: GAMInterstitial) {
  print("Interstitial adapter class name: \(interstitial.responseInfo.adNetworkClassName)")
}

Objective-C

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

Native

Swift

func adLoader(_ adLoader: GADAdLoader,
              didReceive nativeAd: GADUnifiedNativeAd) {
  print("Native adapter class name: \(nativeAd.responseInfo.adNetworkClassName)")
}

Objective-C

- (void)adLoader:(GADAdLoader *)adLoader
    didReceiveUnifiedNativeAd:(GADUnifiedNativeAd *)nativeAd {
  NSLog(@"Native adapter class name: %@", nativeAd.responseInfo.adNetworkClassName);
}

Refer to Retrieving Information about the Ad Response for details.

Rewarded ads mediation

We recommend that you override all default reward values by setting reward values in the Ad Manager UI. To do this, select the Override reward settings from third-party ad networks when using mediation box so that the reward is consistent across all networks. Some ad networks don't provide a reward value or type at all. By overriding the reward value, the reward is consistent no matter which ad network served the ad.

Refer to set up and traffic rewarded ads for apps for more information.

Native ads mediation

The following are some best practices to consider when implementing native mediation.

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 policies of the mediated network that provided the ad.
Avoid using the GADMultipleAdsAdLoaderOptions class when making requests
Requests for multiple native ads only serve Google ads. The multiple native ads feature does not support mediation.