Mediate MoPub Through Google

Prerequisites

  • Minimum required Google Mobile Ads SDK:
    • iOS: v7.14.0
    • Android: v9.6.1
  • Minimum MoPub SDK: v4.10.0

Before You Go Live

The Google Mobile Ads SDK is expected to control the refresh rate. The MoPub SDK refresh must be disabled. This is an important setting to confirm before you go live.

To disable the MoPub refresh:

  1. Click Edit ad unit settings for any ad unit.

  2. Set the Refresh interval to zero.

Mediate MoPub Using AdMob: High-Level Instructions

  1. Download and add the MoPub SDK for Android or iOS and MoPub Adapters to your project.

  2. Add the mediation adapter in your project following the instructions below.

  3. Set up MoPub mediation in the AdMob UI.

Refer to Google’s Android and iOS documentation for more detail.

Mediate MoPub Using Google Ad Manager: High-Level Instructions

  1. Download and add the MoPub SDK for Android or iOS.

  2. Download and add the MoPub Adapters to your project. Instructions below.

  3. Set up Mediation Group in Google Ad Manager. Your account must be linked to the AdX ad exchange.

  4. Within the mediation group, select Ad Format and define targeting.

  5. Add MoPub as a Mediation Network.

  6. For the Integration Type, select Mobile SDK.

  7. Make sure you have an AdX line item targeting the same inventory as your Mediation Group.

Integrate the MoPub Adapter: Detailed Instructions

iOS

Integrate Using Cocoapods

  1. Add the following line to your project’s Podfile: pod 'GoogleMobileAdsMediationMoPub'.

  2. Run pod install.

Integrate Manually

Add or drag the MoPubAdapter.framework into your Xcode project.

Pass Extra Data to MoPub

You can optionally register a GADMoPubNetworkExtras class with the ad request to set the desired size for the MoPub privacy icon in points. Values can range from 10 to 30 inclusive, with a default size of 20.

GADRequest *request = [GADRequest request];
GADMoPubNetworkExtras *extras = [[GADMoPubNetworkExtras alloc] init];
extras.privacyIconSize = 20;
[request registerAdNetworkExtras:extras];

Android

Integrate the Adapters

Add the compile dependency with the latest version of the MoPub adapter in the build.gradle file:

dependencies {
  compile 'com.google.ads.mediation:mopub:4.12.0.0' // replace with the adapter version you wish to integrate
}

Pass Extra Data to MoPub

You can use the MoPubAdapter.BundleBuilder class to create a bundle with optional information to be passed to the MoPub adapter in an AdRequest:

Bundle bundle = new MoPubAdapter.BundleBuilder()
    .setPrivacyIconSizeDp(15)
    .build();
AdRequest adRequest = new AdRequest.Builder()
    .addNetworkExtrasBundle(MoPubAdapter.class, bundle)
    .build();

Native Ads Notes

  • Ad rendering: MoPub has five assets including icon, title, description, main image and CTA text.

  • Impressions and click tracking: The latest documentation and code samples for the Google Mobile Ads SDK are available at the AdMob Developer Docs.

FAQ

Why does “no fill” result in blank ad slots?

We recommend working directly with Google Ad Manager to resolve no fill (blank ad slot) problems. Fill rates are impacted by your available inventory that is set up in the Google Ad Manager dashboard. Additionally, MoPub Marketplace does not fill all impressions, and when Marketplace does not have fill for an ad opportunity, we notify Google Ad Manager to look to other sources, such as AdX backfill.

Why is the user agent that we are sending in the Google Ad Manager ad request invalid, causing the Google Ad Manager ad request to fail with a 400 response?

The GADBannerView may have been instantiated inside the MoPub mediator before it was configured. To correct this, remove the instantiation of GADBannerView inside MoPub before recreating an instance of bannerView for a banner.

Can MoPub be mediated outside of Google Ad Manager mediation or yield groups?

Yes, MoPub can be trafficked as a line item creative, but only for banners and interstitials. Native ad format mediation is only supported through mediation or yield groups.

Can I adjust the Google Ad Manager timeout threshold for MoPub mediation to be greater than 5000 ms?

If you’re using mediation or yield groups, you cannot change the timeout threshold; the default of 5000 ms will be used.

Last updated August 24, 2020

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.)