If you plan to use the MoPub SDK to load and display ads from AdMob and Google Ad Manager via mediation, use this article for integration instructions and information unique to the ad network. To learn more about how MoPub mediation works, refer to our MoPub Network Mediation article.

Supported Ad Formats

Google currently supports the following ad formats. For support information, visit the Google AdMob homepage.

MoPub Formats Google Ad Formats
Banner Banner
Medium Rectangle Banner
Interstitial Interstitial
Rewarded Ad Rewarded Ad
Native Native

Download and Integrate

The same adapters and SDKs support both AdMob and Google Ad Manager. To download the adapters, navigate to the Mediation Integration Tool. You must also download the Mobile Ads SDK:

  • Download the Mobile Ads SDK for iOS

  • Download the Mobile Ads SDK for Android

    For Android, adapters are released as an Android Archive (AAR) file starting with version The AAR includes any required Manifest data for AdMob and Google Ad Manager. You no longer need to update the AndroidManifest manually for any generic data, such as permissions and Activities. Any other app-level placement configuration required by Google must be manually entered into the AndroidManifest.

For the latest download and integration instructions, consult Google’s tutorials before you integrate the SDK and adapters.

Update Your AndroidManifest.xml and Info.plist

This is a required step starting with v17.0.0 of the Mobile Ads SDK. Failure to do this results in a crash.

  • If you mediate AdMob, refer to these Android and iOS instructions.

  • If you mediate Google Ad Manager, refer to these Android and iOS instructions.

Pass Data to Google

Google allows publishers to pass a URL String to target using content mapping, as well as test device IDs to activate test mode. To take advantage of data passing capabilities, you must use v17.1.2.2 or higher of the Android adapter, and v7.37.0.0 or higher of the iOS adapter. Then, follow the steps below in the implementation when you integrate the MoPub SDK.

Note that the adapters currently do not support Google Ad Manager Custom Targeting.


  1. Create a Map to hold two key-value pairs, where the keys are case-sensitive.

    • For content mapping, the key is contentUrl, and the value is the URL String you want to pass to Google.
    • For test device IDs, the key is testDevices, and the value is the test device ID String of your device.
     Map<String, Object> localExtras = new HashMap<>();
     localExtras.put("contentUrl", "");
     localExtras.put("testDevices", "0123456789");
  2. Depending on the ad format you are integrating, pass the Map created from step 1 to the correct API, as shown:

     // Banner
     // Interstitial
     // Rewarded Ad
     // Pass the GooglePlayServicesMediationSettings to the SDK's initialization call
     SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder(adUnitId)
     .withMediationSettings(new GooglePlayServicesRewardedVideo.GooglePlayServicesMediationSettings("", "0123456789"))
     // Native
  3. Make your ad request.


  1. Create an NSDictionary to hold two key-value pairs, where the keys are case-sensitive.

    • For content mapping, the key is contentUrl, and the value is the URL String you want to pass to Google.
    • For test device IDs, the key is testDevices, and the value is the test device ID String of your device.
     NSDictionary *localExtras = @{@"contentUrl" : @"", @"testDevices" : @"0123456789"};
  2. Depending on the ad format you are integrating, pass the NSDictionary created from step 1 to the correct API, as shown:

     // Banner
     MPAdView.localExtras = localExtras;
     // Interstitial
     MPInterstitialAdController.localExtras = localExtras;
     // Rewarded Ad
     [MPRewardedAds userDataKeywords:nil location:nil customerId:@"testCustomerId" mediationSettings:@[] localExtras:localExtras];
     // Native
     MPNativeAdRequestTargeting *targeting = [[MPNativeAdRequestTargeting alloc] init];
     targeting.localExtras = localExtras;
  3. Make your ad request.

Network Reporting

To access AdMob network reports:

  1. First, enable reporting for AdMob as shown:

    AdMob Network Page

Set Up AdMob on the MoPub Dashboard

Configure AdMob ad unit IDs against the native MoPub ad unit IDs of your app as shown:

![AdMob Network with AdMob IDs](/assets/images/docs/mediation/google-2.png)

To find your AdMob ad unit ID, in the AdMob dashboard click Apps in the sidebar > Click the name of the app associated with the ad unit > Click Ad units in the sidebar > Click the Copy icon in the Ad unit ID column to copy the ID of an ad unit.

Mediate AdMob Native Ad Demand

AdChoices Options

Google provides the option to select any of the four corners of the ad to render the AdChoices icon. To set a preferred AdChoices icon position for your app, follow the steps below. Be sure to set the preferred position before the ad request. The icon is rendered in the top right corner by default if no custom position is set.

  • For iOS:

    Call setAdChoicesPosition: from MPGoogleAdMobNativeCustomEvent with your preferred GADAdChoicesPosition position:

     [MPGoogleAdMobNativeCustomEvent setAdChoicesPosition:GADAdChoicesPositionBottomRightCorner];
  • For Android:

    Pass the preferred position to a HashMap, then pass the HashMap in the setLocalExtras() call:

     HashMap<String, Object> extras = new HashMap<>();
     extras.put(GooglePlayServicesNative.KEY_EXTRA_AD_CHOICES_PLACEMENT, NativeAdOptions.ADCHOICES_TOP_LEFT);

(Optional) Additional Assets

Google also supports the following additional assets that you can access:

  • Star Rating (app-install ads only): Textview showing the star rating on 5.
  • Price (app-install ads only): Textview showing price of the app.
  • Store (app-install ads only): Textview app store name.
  • Advertiser (content ads only): Textview showing the name of the advertiser.

Use these APIs to access the additional assets:

  • For iOS:

     static NSString *const kGADMAdvertiserKey = @"advertiser";
     static NSString *const kGADMPriceKey = @"price";
     static NSString *const kGADMStoreKey = @"store";
     - (void)layoutCustomAssetsWithProperties:(NSDictionary *)customProperties {
         _priceLabel.text = [NSString stringWithFormat:@"%@", customProperties[@"price"]];
         _storeLabel.text = [NSString stringWithFormat:@"%@", customProperties[@"store"]];
  • For Android:

     ViewBinder mViewBinder = new ViewBinder.Builder(R.layout.native_ad_item)
             // bind to the other required assets here

Best Practices

MoPub Manual Integration

When using MoPub’s manual integration via AdapterHelper, avoid using a recycled view that once displayed an ad from AdMob to display one from another network, and vice versa. The following code snippet shows how to render and show ads when manually integrating:

if (nativeAd.getMoPubAdRenderer() instanceof GooglePlayServicesAdRenderer) {

   // When creating an AdMob ad using AdapterHelper's
   // getAdView(convertView, parent, nativeAd, viewBinder), do not pass a view used to
   // display an ad from another network as convertView instead let the AdapterHelper
   // create a new one. Views used to show another AdMob ad can be reused.

} else {
   // Create/show ads from other networks.


AdMob renders the AdChoices icon in one of the four corners of the native ad view by default. Some layout designs can cause this icon to appear to be outside the ad’s content area. The following are some examples of the view hierarchies that may cause the AdChoices icon to be rendered on top of margins.

  • Layouts with empty views used as padding/margins:


  • Layout with margin on the child view (containing assets) relative to the outermost view.


  • Layouts with a margin on the outermost view.


Note: The Google Mobile Ads SDK considers the bounds of the top level view of the layout used to create the MoPub ViewHolder to define the bounds of the native ad’s presentation, and will place the AdChoices icon in one of the corners of those bounds.

The Google Mobile Ads SDK supports a different setting you can use to specify the location of the AdChoices placement, and it addresses the layouts with margins noted above. However, your account must be enabled by AdMob for this feature. If you are affected by this margin issue, and placing AdChoices in one of the four corners of the native ad view is not sufficient, contact your Google account manager to request this feature. Once your account is allowlisted to use the customized AdChoices placement, follow the steps below.


  • Modify your ad view layout by wrapping the MoPub privacy information icon with a FrameLayout with the ID native_ad_choices_icon_container. For example, if your privacy icon layout looks like this:

     <ImageView android:id="@+id/native_ad_daa_icon_image"
                 android:padding="10dp" />

    Modify it to look like like this:

     <FrameLayout android:id="@+id/native_ad_choices_icon_container"
                 android:padding="10dp" >
        <ImageView android:id="@+id/native_ad_daa_icon_image"
                   android:layout_height="match_parent" />
  • Add the ID of the FrameLayout as an extra to the ViewBinder that would be provided to the GooglePlayServicesAdRenderer using the key GooglePlayServicesAdRenderer.VIEW_BINDER_KEY_AD_CHOICES_ICON_CONTAINER.

     mViewBinder = new ViewBinder.Builder(R.layout.native_ad_item)
       // bind to the other required assets here


No additional code is required. The Google adapter will place its AdChoices icon in the same spot where you placed the MoPub privacy icon.

Known Issues

  • Android: the AdChoices icon not visible when using CardView as the view passed to MoPub.
  • Android: MoPub will not collect the advertising ID in pre-5.5 SDKs if is missing. Please check the dependencies as mentioned here.

OAuth Authentication for Auto CPM

Follow these steps to take advantage of Auto CPM.

Migrate to the AdMob API

If you set up Google Network Reporting before May 29, 2020, you are receiving AdMob data from the AdSense API, which is being sunset by Google on October 12th, 2021. Follow these steps to upgrade your account to the new AdMob API connection:

  1. In the Networks tab, select AdMob.
  2. Under Reporting Access, select Revoke Access.
  3. Under Reporting Access, select Link Account and re-enter your credentials. Save.

Test an Ad

We recommend that you test your Google integration using MoPub mediation test mode to verify that the adapter works as expected. Test mode must be set up on both the MoPub side and the Google side.

Set Up Test Mode on the MoPub Side

Refer to our Mediation Test Mode article for complete details on using this mode.

Set Up Test Mode on the Google Side

Google supports a global test mode via its UI. You can enable test mode for each platform and target it to specific test devices.

Google also provides test ads that you can use without any setup. There are two ways to get Google test ads:

  • Use one of Google’s sample ad units. Refer to Google’s instructions on how to do this for iOS or Android. You can directly enter these Google ad details into your MoPub network test mode setup (instructions here).

  • Use your own ad unit, and enable test devices. This is similar to how other MoPub network partners support test mode. Refer to Google’s instructions for setting up a test device.

Last updated August 28, 2021

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.

© 2021 MoPub (a division of Twitter, Inc.)