Integrating MoPub with Mediation

This guide is intended for publishers who want to use the Google Mobile Ads SDK
to load and display ads from MoPub via
mediation. It covers
how to add MoPub to an ad unit's mediation configuration, how to set up
Ad Network Optimization (ANO),
and how to integrate the MoPub SDK and adapter into an
Android app.

Supported ad formats and features

The AdMob mediation adapter for MoPub has the
following capabilities:

Formats

Banners

Interstitials

Rewarded Video

Native Advanced

Features

Smart banners

Ad Network Optimization (ANO)

Native Video

Requirements

Android SDK 4.1 (API level 16) or higher

Google Play services 9.6.1 or higher

Step 1: Set up MoPub

First, sign up and log in to your
MoPub UI. Navigate to the
Apps page and click the Add a New App button.

Select Android as the Platform for your app,
enter the App name and
Package name
of your app. Then select a primary and secondary category of your app from the
provided list.

Note: To add an Ad Unit to an existing app, navigate to the
Apps page in the MoPub's UI and select the app for
which you want to add the Ad Unit. On your app's details page, click the
Add an Ad Unit button.

Banner

Choose Tablet as the Device type. Choose a banner format that
matches the ad size you're requesting in your app. Enter a Name for your
Ad Unit.

The refresh rate is handled by the Google Mobile Ads SDK according to your
refresh rate setting in the AdMob UI. So, we
recommend using a high value for the Refresh Interval here
(e.g. 1000 seconds).

Note: The Banner size chosen here should match the request size in your app.
The adapter ignores the size passed during the banner ad request.

Interstitial

Choose Tablet as the Device type. Choose Fullscreen Tablet as
the Format. Enter a Name for your Ad Unit. Choose the type of
Layout to present the ad in.

Native

Choose Tablet as the Device type. Choose Native (Custom layout)
as the Format. Enter a Name for your Ad Unit.

Note: Your app is responsible for placing the ad when integrating native ads
with the Google Mobile Ads SDK. The MoPub adapter is not responsible for ad
positioning, just passing back the native ad assets. It does not use the
AdPlacer code. Therefore, the Ad positions setting is ignored.

MoPub Marketplace

To get ads from MoPub, your account needs to be approved for MoPub Marketplace.
During your initial account setup, you will be prompted to go through the
process for Marketplace approval. Part of this process includes entering your
payment information.

Note: Ad network optimization takes a few days to gather data to accurately
calculate eCPM for a mediation network. In the meantime, the ANO status will be
PENDING, so you must manually set an eCPM value for the network. Once the eCPM
can be calculated, ANO will automatically start updating the eCPM on your
behalf.

Step 3: Import the MoPub SDK and adapter

Android Studio integration (recommended)

Add the following Maven repository and the implementation dependencies with
the latest versions of the MoPub SDK and adapter in the app-level
build.gradle file:

Before loading ads, have your app initialize the MoPub SDK by calling
MoPub.initializeSdk() with your MoPub Ad Unit ID
that you created in Step 1. This needs to be
done only once, ideally at app launch.

Step 5: Test your implementation

To get test ads from MoPub, you need a guaranteed or backfill line item. MoPub
recommends adding the Demo line item to your Ad Unit to get test ads. The
Demo line item is added to your MoPub account by default.

The Demo Line Item contains test creatives for native and banner ad units by
default, but does not have a test creative for interstitial ad units. To add
your own test creative for interstitial ads, you need to upload a simple image
to the MoPub UI by
navigating to the Demo Line Item and clicking the Add a New Creative button.
Choose Tablet Full Screen format. Fill the form with the necessary details
and click Save to add your test creative to the Demo Line Item.

That's it! You now have a working mediation integration with MoPub.

Optional steps

EU Consent and GDPR

Under the Google EU User Consent
Policy, you must ensure that certain disclosures are given to, and
consents obtained from, users in the European Economic Area (EEA) regarding
the use of device identifiers and personal data. This policy reflects the
requirements of the EU ePrivacy Directive and the General Data Protection
Regulation (GDPR). When seeking consent, you must identify each ad network
in your mediation chain that may collect, receive, or use personal data and
provide information about each network's use. Google currently is unable to
pass the user's consent choice to such networks automatically.

Permissions

If the user's location needs to be used for the targeting, MoPub recommends
adding the following optional permission into your app's AndroidManifest.xml
file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

MoPub recommends adding the following optional permission for MRAID 2.0: