Share your feedback about the Google Mobile Ads SDK! Take the annual survey.

Mediation Test Suite

The AdMob Mediation Test Suite allows you to test whether you have correctly configured your application and ad units to be able to display ads from third-party networks via AdMob mediation.

This guide outlines how to use the AdMob Mediation Test Suite in your Unity app. The first step is integrating the tool into your app.

Prerequisites

Installation

Download Mediation Test Suite

After downloading the Mediation Test Suite, with your Unity project open, double-click the Unity package and import the files into your project.

Once this is complete, you have integrated the GoogleMobileAdsMediationTestSuite into your Unity project.

Launching the Mediation Test Suite

To include the test suite into a script, you must first add the following imports:

using GoogleMobileAdsMediationTestSuite.Api;

Next, call MediationTestSuite.Show() to launch the test suite.

private void ShowMediationTestSuite()
{
    MediationTestSuite.Show();
}

Note that you need to have correctly configured your AdMob App ID for this to correctly show the test suite.

The Unity plugin provides a convenient wrapper to enable you to easily integrate and launch the test suite from the Unity environment. Once the test suite is launched, it looks the same as the iOS and Android test suites. Follow these respective guides for help navigating the test suite.

Knowing when the Test Suite is dismissed

If you want to be notified when the test suite is dismissed, you can register a delegate to the MediationTestSuite.OnMediationTestSuiteDismissed event handler.

public void Start()
{
    MediationTestSuite.OnMediationTestSuiteDismissed += this.HandleMediationTestSuiteDismissed;
}

public void HandleMediationTestSuiteDismissed(object sender, EventArgs args)
{
    MonoBehaviour.print("HandleMediationTestSuiteDismissed event received");
}

One practical use case for this event is to know when to resume your game.

Enabling testing in production and non-development builds

By default, the mediation test suite will only launch in development / debug builds. This is meant to prevent end users from inadvertently launching the test suite.

If you have a need to run the mediation test suite on device once it’s in production, you should whitelist your device using the AdMob test device ID (retrieved from your console logs) prior to distributing the build.

To add the device to the whitelist use the AdRequest.Builder to add the test device ID and then set the configured ad request to be used by the mediation test suite:

MediationTestSuite.AdRequest = new AdRequest.Builder()
  .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")
  .Build();

When including the mediation test suite in a production app, you’ll need a hidden way to launch the mediation test suite (that is a secret gesture or a hidden debug menu). You’ll then be able to launch the test suite on any device that’s been whitelisted in the build.

Configuring ad requests with network extras (optional)

Certain mediated networks, such as Vungle, require or have the option to provide a custom network extras object to provide additional information to requests to their network. If you need to provide network extras for your mediation requests you can set an ad request for the test suite to use using the MediationTestSuite.AdRequest static property:

AdRequest adRequestBuilder = new AdRequest.Builder();
...
// Set your network extras for your chosen networks here.
// i.e for each network extras object, call
// 'adRequestBuilder.AddMediationExtras(<network extras>)'
...
MediationTestSuite.AdRequest = adRequestBuilder.Build();

Ensure that you do this before calling MediationTestSuite.Show().

This enables you to instantiate and configure an ad request with any required extras, which the test suite can then use in its request to the mediated network.

Frequently Asked Questions

Does the disclaimer show every time?
Yes, we do this intentionally as a reminder that pubs should turn on test mode for their mediation ad sources.
Why do I see AdMob multiple times on the Ad Unit details page?
If multiple mediation groups target the same ad unit, we combine all of the groups together. For example, you may see multiple AdMob entries and possibly multiple of other ad sources. Even inside the same mediation group, a mediation partner can be defined up to 3 times.
Which networks / ad sources are supported by the mediation test suite?
The test suite works for all open source and versioned adapters as well as custom event adapters. The ad networks in our open source initiative are listed on our mediation page.

Send feedback about...

Need help? Visit our support page.