This guide shows you how to integrate a mediation adapter with your current iOS app and set up additional request parameters.
Prerequisites
Before you can integrate mediation for an ad format, you need to integrate that ad format into your app:
New to mediation? Read Introduction to mediation.
Know which ad network wins
Each ad format class has a GADResponseInfo
property that contains adNetworkClassName
which returns the class name of the ad network for the current ad. adNetworkClassName
only has a value once an ad successfully
loads. The code below shows you how to get that information for banner ads.
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); }
Refer to Retrieving Information about the Ad Response for details.
Banner ads mediation
Make sure to disable refresh in all third-party ad networks UI for banner ad units used in Ad Manager mediation. This will prevent a double refresh since Ad Manager also triggers a refresh based on your banner ad unit's refresh rate.
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.
CCPA and GDPR
If you need to comply with the California Consumer Privacy Act (CCPA) or General Data Protection Regulation (GDPR), follow the steps in CCPA settings or GDPR settings to add your mediation partners in Ad Manager Privacy & messaging's CCPA or GDPR ad partners list. Failure to do so can lead to partners failing to serve ads on your app.
Learn more about enabling CCPA restricted data processing and obtaining GDPR consent with Google User Messaging Platform (UMP) SDK.