Open Bidding Mediation Beta

This guide is intended to help you integrate Open Bidding mediation into your Unity app.

Prerequisites

  • Contact your account manager to get your app whitelisted to use Open Bidding.
  • Set up AdMob mediation groups configured with Open Bidding networks.
  • Google Mobile Ads Unity plugin 3.18.2 or higher.

Open Bidding exchanges

There are two types of open bidding integrations: those that require a third-party SDK and those that don't.

The open bidding partners listed below do not require a separate third-party SDK or adapter library. These integrations can be enabled without additional changes to your app code.

Exchanges Banner Interstitial Rewarded Video
OpenX
PubMatic
Rubicon
Smaato
TripleLift

The rest of this guide explains what's needed to enable open bidding integrations that do require an SDK.

Enable Open Bidding flag on Android

Open the Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml file in your project and add in the following <meta-data> tag to enable Open Bidding:

<application>
  <uses-library android:required="false" android:name="org.apache.http.legacy"/>
  <!-- Your AdMob App ID will look similar to this sample ID: ca-app-pub-3940256099942544~3347511713 -->
  <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
  <meta-data
      android:name="com.google.android.gms.ads.flag.rtb_enabled"
      android:value="true"/>
</application>

Initialize the Mobile Ads SDK

Before loading ads, have your app initialize the Mobile Ads SDK, as well as your mediation partners’ SDKs by calling MobileAds.Initialize(), with an Action<InitializationStatus> object. This needs to be done only once, ideally at app launch.

Upon initialization completion, the Action<InitializationStatus> provided to MobileAds.Initialize() is invoked. The InitializationStatus argument is an immutable snapshot of the Mobile Ads SDK's initialization status, as well as the initialization status of each adapter your app is mediating to.

Call getAdapterStatusMap() on the InitializationStatus object to get the initialization status of each mediation ad network available to the Mobile Ads SDK, identified by the adapter class name.

using GoogleMobileAds.Api;
using System.Collections.Generic;
...

public class GoogleMobileAdsDemoScript : MonoBehaviour
{
    ...

    public void Start()
    {
        // Initialize the Mobile Ads SDK.
        MobileAds.Initialize((initStatus) =>
        {
            Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
            foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
            {
                string className = keyValuePair.Key;
                AdapterStatus status = keyValuePair.Value;
                switch (status.InitializationState)
                {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
                }
            }
        });
        ...
    }
}

Note that after 10 seconds, the SDK invokes the OnInitializationCompleteListener even if a mediation network still hasn't completed initialization.

It is a best practice to load an ad inside the callback of the OnInitializationCompleteListener. Even if a mediation network is not ready, the SDK will still ask that network for an ad. So if a mediation network finishes initializing after the timeout, it can still service future ad requests in that session.

You can continue to poll the initialization status of all adapters throughout your app session by calling MobileAds.getInitializationStatus().

If you would like to know why a particular mediation network isn't ready, call AdapterStatus.getDescription(), which describes why an adapter is not ready to service ad requests.

Choose your open bidding networks

Integrating open bidding requires changes in these places:

  1. Third-party ad network UI - Sign up for the third-party ad network and create a placement in their UI.
  2. AdMob UI - Update your ad unit's mediation settings to include the ad network.
  3. App code - Update your app to include the third-party ad network's SDK, and an adapter library that communicates between Google and the third-party ad network to request and serve ads.

The ad network guides linked below walk you through each of these steps. Select an ad network below to get started.

Ad Network Banner Interstitial Rewarded Video
AdColony
AppLovin
Facebook
InMobi
Tapjoy

Troubleshooting

The presence of the a3p parameter in the ad request to Google indicates that at least one open bidding network is properly integrated into your app. If a3p isn't in the ad request, here are potential reasons why:

  • You did not initialize the mobile ads SDK using the new initialization method.
  • You forgot to enable the open bidding flag on Android.
  • You loaded the ad before the third-party ad network's SDK was initialized. To ensure all open bidding partners can participate, we recommend waiting to load an ad until after your Action<InitializationStatus> gets called.
  • Your AdMob ad unit doesn't target a mediation group that has an open bidding entry configured for that third-party ad network.
  • Your AdMob ad unit belongs to a different AdMob app than the one you initialized with. When initialization occurs, the Google Mobile Ads SDK only pulls down information about the ad units from the AdMob app ID you initialized.