Integrating Unity Ads with Mediation

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

Supported ad formats and features

The AdMob mediation adapter for Unity Ads has the following capabilities:

Formats
Banners
Interstitials
Rewarded Video
Rewarded Video (new APIs)
Features
Smart Banners
Ad Network Optimization (ANO)

Requirements

  • Unity 4 or higher
  • To deploy on Android:
    • Android SDK 4.0 (API level 14) or later
    • Google Play services 18.1.1 or later
  • To deploy on iOS:
    • Xcode 9.2 or higher
    • iOS Deployment target of 8.0 or higher
    • Google Mobile Ads SDK 7.42.2 or higher
  • A working Unity project configured with Google Mobile Ads SDK. See the Quick Start Guide for details.

Step 1: Set up Unity ads

Sign up or log in to Unity Ads.

On the Unity Ads Dashboard, navigate to the Project tab and click the New Project button.

Fill out the form and click Add Project at the bottom of the page to add your project to Unity Dashboard.

Once your project is created, navigate to the Monetization > Placements tab of your project and take note of the Game ID for both platforms.

To create a new placement, click the Add Placement button.

For additional instructions on creating an ad placement, select the tab corresponding to your preferred ad format.

Banner

Enter your desired Placement ID, select Banner as the ad format and click Create Placement.

Interstitial

Enter your desired Placement ID, select Interstitial Video as the ad format and click Create Placement.

Rewarded Video

Enter your desired Placement ID, select Rewarded Video as the ad format and click Create Placement.

In addition to the Game ID and the Placement ID you will also need Unity Ads API Key for setting up your AdMob ad unit ID. Navigate to the Ads Data Export > API Access tab of the Unity Ads Dashboard and take note of the GameAds API Access Key.

Step 2: Configure mediation settings for your AdMob ad unit

You need to add Unity Ads to the mediation configuration for your AdMob ad unit(s). First sign in to the AdMob UI.

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

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 Unity Ads 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.

Android

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled. Then click Add Ad Units, which will open up the ad unit selection overlay.

New mediation group 2

Associate this mediation group with your existing AdMob ad unit. Then click Done.

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

Mediation group ad units

iOS

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled. Then click Add Ad Units, which will open up the ad unit selection overlay.

New mediation group 2

Associate this mediation group with your existing AdMob ad unit. Then click Done.

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

Mediation group ad units

Add Unity Ads as an ad source

In the Ad Sources card, select Add Ad Network. Then select Unity Ads.

Enable the Optimize switch. Enter your API Key obtained in the previous section to set up ANO for Unity Ads. Then enter an eCPM value for Unity Ads and click Continue.

Next, enter the Game ID and Placement ID obtained in the previous section. Then click Done.

Android

iOS

Finally, click Save.

Using rewarded video ads

In the settings for your rewarded video 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 Unity adapter defaults to a reward of type "" (empty string) with a value of 1. The Unity Ads SDK does not provide specific reward values for its rewarded video ads.

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

Step 3: Import the Unity SDK and Adapter

Download the latest version of the Google Mobile Ads mediation plugin for Unity Ads and extract the GoogleMobileAdsUnityAdsMediation.unitypackage from the zip file.

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

Step 4: Additional Code Required

No Additional code required for Android or iOS deployments.

Step 5: Test Your Implementation

Test ads can be enabled from the Unity Ads dashboard in two ways.

If you want to enable test ads for all devices, navigate to the Settings > Project Settings tab of your project. Under the Test Mode section, edit the Client test mode not overridden section, check Override client test mode box, select Force test mode ON and click Save.

Android

iOS

If you want to enable test ads only for specific devices, navigate to the Ads Data Export > Test Devices tab. Under the Test Devices section, click the Add New Device button and fill out the resulting form.

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.

Follow the instructions below to enable or disable personalized ads for Unity Ads.

Unity Ads provides a GDPR Compliance guide that describes both automatic and manual solutions for user consent.

The Google Mobile Ads mediation plugin for Unity Ads version 1.1.2 adds the UnityAds.SetGDPRConsentMetaData() method. The following sample code shows how to pass consent information to the Unity Ads SDK manually. 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.UnityAds;
// ...

UnityAds.SetGDPRConsentMetaData(true);

Unity Ads Unity Mediation Plugin Changelog

Version 2.2.0

Version 2.1.0

  • Supports Unity Ads Android adapter version 3.1.0.0.
  • Supports Unity Ads iOS adapter version 3.1.0.0.

Version 2.0.3

  • Updated the plugin to support the new open-beta Rewarded API.
  • Adds support for Banner Ads.
  • Supports Unity Ads Android adapter version 3.0.0.2.
  • Supports Unity Ads iOS adapter version 3.0.0.3.

Version 2.0.2

  • Supports Unity Ads Android adapter version 3.0.0.0.
  • Supports Unity Ads iOS adapter version 3.0.0.1.

Version 2.0.1

  • Fixed an "incompatible type" error that caused issues when building for iOS.

Version 2.0.0

  • Supports Unity Ads Android adapter version 3.0.0.0.
  • Supports Unity Ads iOS adapter version 3.0.0.0.

Version 1.2.0

  • Supports Unity Ads Android adapter version 2.3.0.0.
  • Supports Unity Ads iOS adapter version 2.3.0.0.

Version 1.1.3

  • Supports Unity Ads Android adapter version 2.2.1.0.
  • Supports Unity Ads iOS adapter version 2.2.1.0.

Version 1.1.2

  • Supports Unity Ads Android SDK version 2.2.0.
  • Supports Unity Ads iOS SDK version 2.2.0.
  • Added UnityAds.SetGdprConsentMetaData() method to manually request a user opt-in for targeted advertising.

Version 1.1.1

  • Supports Unity Ads Android SDK version 2.2.0.
  • Supports Unity Ads iOS SDK version 2.2.1.

Version 1.1.0

  • Supports Unity Ads Android SDK version 2.2.0.
  • Supports Unity Ads iOS SDK version 2.2.0.

Version 1.0.0

  • First release!
  • Supports Unity Ads Android SDK version 2.1.2.
  • Supports Unity Ads iOS SDK version 2.1.2.