This guide is intended to help you integrate Open Bidding mediation into your Unity app.
Prerequisites
- Contact your account manager to get your app on the allowlist to use Open Bidding.
- Set up AdMob mediation groups configured with Open Bidding networks.
- Google Mobile Ads Unity plugin 3.18.2 or higher.
- Complete steps in Get Started.
- Check out a case study.
Open Bidding partners
There are two types of open bidding integrations: those that require a third-party SDK and those that don't.
An integration with a partner that doesn't require a separate third-party SDK or adapter library won't require an app update. You just need to add an Open Bidding ad source in the AdMob UI.
For partners that require an SDK, additional Google Mobile Ads SDK integration instructions are provided below.
Partner | Banner | Interstitial | Rewarded Video | Native |
---|---|---|---|---|
AdColony 1 | ||||
AppLovin 1 | ||||
Facebook 1 | ||||
Fluct | ||||
Index Exchange | ||||
OpenX | ||||
PubMatic | ||||
Rubicon | ||||
Smaato | ||||
Tapjoy 1 | ||||
TripleLift | ||||
UnrulyX |
1 Partner requires third-party 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:
- Third-party ad network UI - Sign up for the third-party ad network and create a placement in their UI.
- AdMob UI - Update your ad unit's mediation settings to include the ad network.
- 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.
Click on the link of a network in the table for detailed instructions on how to incorporate its SDK.
Troubleshooting
The presence of the a3p
parameter in any request after the first ad request
indicates that at least one open bidding network is properly integrated into
your app.
If a3p
isn't in subsequent ad requests, 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.