Integrating AppLovin with Mediation

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

Supported ad formats and features

The AdMob mediation adapter for AppLovin has the following capabilities:

Formats
Banners
Interstitials
Rewarded Video
Native Advanced
Features
Smart Banners
Ad Network Optimization (ANO)

Requirements

  • Android SDK 4.0 (API level 14) or later
  • Google Play services 9.0.0 or later

Step 1: Set up AppLovin

Sign up or log in to your AppLovin account.

To set up your AdMob ad unit, you'll need your AppLovin SDK Key and Report Key. To find them, go to the AppLovin Dashboard and click on the Account tab. In the dropdown list under Account, select Keys to see both values.

Select app for mediation

On the AppLovin dashboard, select Manage Apps under the Monetize section to get to your registered apps. Select the app you'd like to use with mediation from the list of available apps.

If you do not see your app in the list, it is not registered. In that case, perform the four steps below to get it registered.

Before you can complete the AdMob mediation setup, your app needs to be registered by AppLovin. Once your app initializes the AppLovin SDK, AppLovin automatically detects and registers it. To complete this process:

  1. Follow the steps in the Import the AppLovin SDK section. Once that's done, you'll have the AppLovin SDK integrated in your app.
  2. Add the following meta-data tag to your AndroidManifest.xml file under the application tag using the SDK Key obtained earlier:

    <meta-data android:name="applovin.sdk.key"
            android:value="lJZcB...l7mHlJZ8yvFu36nGvCs3IAv" />
    
  3. Initialize the AppLovin SDK by calling AppLovinSdk.initializeSdk(context); in your launch activity's onCreate() method.

  4. Build and run your app, then wait thirty minutes or so. Afterwards, check the AppLovin dashboard under Monetize > Manage Apps to find your app. Once the registration process is complete, remove the meta-data tag from your app. Optionally, you can remove the initializeSdk call.

Create Zone

On the AppLovin dashboard, select Zones under the Monetize section to get to your registered Zone IDs. If you have already created the required Zones for your app, skip ahead to Step2. To create a new Zone ID, click Create Zone.

Enter the name of Zone ID, select Android as the Platform, and choose the desired Ad Type.

Configure Pricing for the Zone by selecting either Flat CPM or Optimized by AppLovin. CPMs can be configured on a per country basis for the Flat CPM option. Then, click Save.

Once the Zone is created, the Zone ID can be found under the Zone ID column.

Step 2: Configure mediation settings for your AdMob ad unit

You need to add AppLovin to the mediation configuration for your ad unit.

First, sign in to your AdMob account. Next, navigate to the Mediation tab. If you have an existing mediation group you'd like to modify, click the name of that mediation group to edit it, and skip ahead to Add AppLovin as an ad source.

To create a new mediation group, select Create Mediation Group.

Enter your ad format and platform, then click Continue.

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled, and then click Add Ad Units.

Associate this mediation group with one or more of your existing AdMob ad units. Then click Done.

You should now see the ad units card populated with the ad units you selected:

Add AppLovin as an ad source

In the Ad Sources card, select Add Ad Network.

Select AppLovin and enable the Optimize switch. Enter the Report Key obtained in the previous section to set up ANO for AppLovin. Then enter an eCPM value for AppLovin and click Continue.

Enter the Application ID of your app along with the Zone ID and the SDK Key obtained in the previous section.

Using rewarded video ads

In the settings for your rewarded video ad unit, provide values for the reward amount and reward type. Then, to ensure you provide the same reward to the user no matter which ad network is served, check the Apply to all networks in Mediation groups box.

If you don't apply this setting, the AppLovin adapter passes back the reward specified in the AppLovin dashboard when creating the placement.

For more information on setting reward values for AdMob ad units, see Create an ad unit.

Step 3: Import the AppLovin SDK and adapter

Add the following implementation dependency with the latest version of the AppLovin SDK and adapter in the app-level build.gradle file:

...
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:xx.x.x'
    implementation 'com.google.android.gms:play-services-ads:17.1.2'
    implementation 'com.applovin:applovin-sdk:8.1.4'
    implementation 'com.google.ads.mediation:applovin:8.1.4.0'
}
...

Manual integration

  • Download the AppLovin Android SDK, extract the applovin-sdk-8.1.4.jar, and add it to your project.

  • Download the latest AppLovin adapter .aar file from Bintray and add it to your project.

Step 4: Additional code required

Modify Android manifest

Activities

Include the following Activities in your AndroidManifest.xml under the application tag:

<activity android:name="com.applovin.adview.AppLovinInterstitialActivity"
          android:configChanges="orientation|screenSize"/>

<activity android:name="com.applovin.adview.AppLovinConfirmationActivity"
          android:configChanges="orientation|screenSize"/>

Step 5: Test your implementation

AppLovin recommends that test ads should be used during development if you cannot get live ads.

To enable test ads, go to the Manage Apps page by clicking on your app's name in the AppLovin dashboard and navigate to the Test Mode section. Toggle the Test Mode switch to ON.

Test Mode may take up to 30 mins to take effect. It will also automatically reset to OFF after two hours.

Optional steps

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.

The section below shows you how to enable or disable personalized ads for AppLovin.

In SDK version 8.0.1, AppLovin added the setHasUserContent and setIsAgeRestrictedUser methods. The following sample code shows how to pass consent information to the AppLovin SDK. It is recommended that you call these methods prior to requesting ads via the Google Mobile Ads SDK.

import com.applovin.sdk.AppLovinPrivacySettings;
//…

AppLovinPrivacySettings.setHasUserConsent(true, context);

Additionally, if the user is known to be in an age-restricted category, you can also set the below flag to true.

AppLovinPrivacySettings.setIsAgeRestrictedUser(true, context);

See AppLovin's privacy settings for more details.

Network-specific parameters

The AppLovin adapter supports setMuteAudio() which can disable audio on video ads. This method can be called from an AppLovinExtrasBundleBuilder object:

JAVA

Bundle extras = new AppLovinExtrasBundleBuilder()
       .setMuteAudio(true)
       .build();
AdRequest request =  new AdRequest.Builder()
       .addNetworkExtrasBundle(ApplovinAdapter.class, extras)
       .build();

KOTLIN

val extras = AppLovinExtrasBundleBuilder()
       .setMuteAudio(true)
       .build()
val request = AdRequest.Builder()
       .addNetworkExtrasBundle(ApplovinAdapter::class.java, extras)
       .build()

Optimizations

Adding AppLovinSdk.initializeSdk(context); to your launch activity provides AppLovin the ability to track events as soon as the app starts.

Send feedback about...

Need help? Visit our support page.