Integrating AppLovin with Mediation

This guide is for publishers who want to use the Google Mobile Ads SDK to load and display ads from AppLovin through bidding and waterfall mediation. It covers how to integrate the AppLovin SDK and adapter into a Unity app.

Supported formats and features

The AdMob mediation adapter for AppLovin has the following capabilities:

Formats
Banner  1
Interstitial
Rewarded
Features
Adaptive banner
Ad network optimization (ANO)
Bidding

Banner ads (excluding MREC banners) are supported only in mediation. Bidding does not support any type of banner ads.

Requirements

  • Unity 5.6 or higher
  • Latest Google Mobile Ads SDK
  • [For bidding]: Google Mobile Ads mediation plugin for AppLovin 4.2.0 or higher
  • To deploy on Android
    • Android API level 16 or higher
  • To deploy on iOS
    • iOS deployment target of 8.0 or higher
  • A working Unity project configured with Google Mobile Ads SDK. See Get Started for details.

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.

[Waterfall only] Select app for mediation

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

[Waterfall only] Create Zone

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

Choose your platform to create a Zone.

Android

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.

iOS

Enter the name of Zone ID , select iOS as the Platform, and 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.

Android

iOS

Step 2: Configure mediation settings for your AdMob ad unit

You need to add AppLovin to the mediation configuration for your AdMob ad units. First, sign in to your AdMob account.

If you're deploying your Unity app to both Android and iOS, you need two AdMob ad units, one for each platform.

Android

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.

AdMob mediation tab

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. Then click Add Ad Units.

New mediation group 2

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

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

Mediation group ad units

Add AppLovin as an ad source

Waterfall

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.

Bidding

In the Ad Sources card, select Add Ad Network. Select AppLovin (Bidding). Then, enter the SDK Key obtained in the earlier section.

iOS

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. Then click Add Ad Units.

Associate this mediation group with one or more of your existing 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

Waterfall

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 Bundle ID of your app along with the Zone ID and the SDK Key obtained in the previous section.

Bidding

In the Ad Sources card, select Add Ad Network. Select AppLovin (Bidding). Then, enter the SDK Key obtained in the earlier section.

Using rewarded ads

In the settings for your rewarded ad unit, check the Apply to all networks in Mediation groups box so that you provide the same reward to the user no matter which ad network is served.

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

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

Step 3: Import the AppLovin SDK and adapter

Download the latest version of Google Mobile Ads mediation plugin for AppLovin from the download link in the Changelog and extract the GoogleMobileAdsAppLovinMediation.unitypackagefrom the zip file.

In your Unity project editor, select Assets > Import Package > Custom Package and find the GoogleMobileAdsAppLovinMediation.unitypackage file you downloaded. Make sure that all the files are selected and click Import.

Then, select Assets > Play Services Resolver > Android Resolver > Force Resolve. The Unity Play Services Resolver library will perfrom dependency resolution from scratch and copy the declared dependencies into the Assets/Plugins/Android directory of your Unity app.

Step 4: Additional code required

No additional code required for AppLovin integration.

Step 5: Test your implementation

AppLovin recommends that test ads 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 minutes 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.

The Google Mobile Ads mediation plugin for AppLovin version 3.0.1 includes the AppLovin.SetHasUserConsent() and AppLovin.SetIsAgeRestrictedUser() methods. The following sample code shows how to pass consent information to the AppLovin SDK. If you choose to call this method, it is recommended that you do so prior to requesting ads via the Google Mobile Ads SDK.

using GoogleMobileAds.Api.Mediation.AppLovin;
// ...

AppLovin.SetHasUserConsent(true);

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

AppLovin.SetIsAgeRestrictedUser(true);

See AppLovin's Privacy Policy for more details.

Optimizations

Adding a call to AppLovin.Initialize() to your launch activity provides AppLovin the ability to track events as soon as the app starts.

Error codes

If the adapter fails to receive an ad from AppLovin, publishers can check the underlying error from the ad response using ResponseInfo under the following classes:

Android

com.google.ads.mediation.applovin.mediation.ApplovinAdapter
com.google.ads.mediation.applovin.AppLovinMediationAdapter

iOS

GADMAdapterAppLovin
GADMAdapterAppLovinRewardBasedVideoAd
GADMediationAdapterAppLovin

Here are the codes and accompanying messages thrown by the AppLovin adapter when an ad fails to load:

Android

Error code Reason
-102 to -900, 204 AppLovin SDK returned an error. See documentation for more details.
101 The requested ad size does not match an AppLovin supported banner size.
103 Context is null.
104 AppLovin bid token is empty.
105 Requested multiple ads for the same zone. AppLovin can only load 1 ad at a time per zone.
106 Ad is not ready to display.
108 AppLovin Adapter does not support the ad format being requested.

iOS

Error code Reason
-1009 to -1, 204 AppLovin SDK returned an error. See Unity's code for more details.
101 The requested ad size does not match an AppLovin supported banner size.
102 AppLovin server parameters configured in the AdMob UI are missing/invalid.
103 Failed to show AppLovin ad.
104 Requested multiple ads for the same zone. AppLovin can only load 1 ad at a time per zone.
105 AppLovin SDK key not found.
107 Bid token is empty.
108 AppLovin Adapter does not support the ad format being requested.
110 AppLovin sent a successful load callback but loaded zero ads.

AppLovin Unity Mediation Plugin Changelog

Version 5.1.2

Version 5.1.1

Version 5.1.0

Version 5.0.0

Version 4.8.1

Version 4.8.0

Version 4.7.0

Version 4.6.2

Version 4.6.1

Version 4.6.0

Version 4.5.8

Version 4.5.7

Version 4.5.6

Version 4.5.5

Version 4.5.4

Version 4.5.3

Version 4.5.2

Version 4.5.1

Version 4.5.0

Version 4.4.1

Version 4.4.0

Version 4.3.0

Version 4.2.0

  • Supports AppLovin Android adapter version 9.4.2.0.
  • Supports AppLovin iOS adapter version 6.6.1.0.

Version 4.1.0

  • Updated the plugin to support the new open-beta Rewarded API.
  • Supports AppLovin Android adapter version 9.2.1.1.
  • Supports AppLovin iOS adapter version 6.3.0.0.

Version 4.0.0

  • Supports AppLovin Android adapter version 9.2.1.0.
  • Supports AppLovin iOS adapter version 6.2.0.0.

Version 3.1.2

  • Supports AppLovin Android adapter version 8.1.4.0.
  • Supports AppLovin iOS adapter version 5.1.2.0.

Version 3.1.1

  • Supports AppLovin Android adapter version 8.1.0.0.
  • Supports AppLovin iOS adapter version 5.1.1.0.

Version 3.1.0

  • Supports AppLovin Android adapter version 8.1.0.0.
  • Supports AppLovin iOS adapter version 5.1.0.0.

Version 3.0.3

  • Supports AppLovin Android adapter version 8.0.2.1.
  • Supports AppLovin iOS adapter version 5.0.2.0.

Version 3.0.2

  • Supports AppLovin Android SDK version 8.0.1.
  • Supports AppLovin iOS SDK version 5.0.1.

Version 3.0.1

  • Supports AppLovin Android SDK version 8.0.0.
  • Supports AppLovin iOS SDK version 5.0.1.
  • Added AppLovin.SetIsAgeRestrictedUser() method to indicate if the user is known to be in an age-restricted category.

Version 3.0.0

  • Supports AppLovin Android SDK version 8.0.0.
  • Supports AppLovin iOS SDK version 5.0.1.
  • Added AppLovin.SetHasUserConsent() method to forward user consent flag to the AppLovin SDK.

Version 2.0.0

  • Supports AppLovin Android SDK version 7.8.6.
  • Supports AppLovin iOS SDK version 5.0.1.

Version 1.2.1

  • Supports AppLovin Android SDK version 7.8.6.
  • Supports AppLovin iOS SDK version 4.8.3.

Version 1.2.0

  • Supports AppLovin Android SDK version 7.8.5.
  • Supports AppLovin iOS SDK version 4.8.3.

Version 1.1.0

  • Supports AppLovin Android SDK version 7.7.0.
  • Supports AppLovin iOS SDK version 4.7.0.

Version 1.0.0

  • First release!
  • Supports AppLovin Android SDK version 7.4.1.
  • Supports AppLovin iOS SDK version 4.4.1.