This guide shows you how to use the Google Mobile Ads SDK to load and display ads from InMobi using mediation, covering waterfall integrations. It covers how to add InMobi to an ad unit's mediation configuration, and how to integrate the InMobi SDK and adapter into a Unity app.
Supported integrations and ad formats
Integration | |
---|---|
Bidding | |
Waterfall | |
Formats | |
Banner | |
Interstitial | |
Rewarded |
Requirements
- Unity 4 or higher
- Latest Google Mobile Ads SDK
- To deploy on Android
- Android API level 19 or higher
- To deploy on iOS
- iOS deployment target of 10.0 or higher
- A working Unity project configured with Google Mobile Ads SDK. See Get Started for details.
Step 1: Set up InMobi
Sign up or log in to your InMobi account.
Add an app
To add your app to the InMobi dashboard, click Inventory > Inventory Settings.
Click Add Inventory and select an inventory channel from the dropdown menu.
Start typing your published app store URL in the search bar and select the app from the auto-populated results. Click Continue.
If your app in not published, click Link manually and enter the required details. Click Continue.
Review the App & Website Compliance settings and then click Save and Create Placements.
Create a placement
After you set up your inventory, the system redirects you to the placement creation workflow.
Once the placement is created, its details are shown. Take note of the Placement ID which will be used for setting up your AdMob ad unit.
Banner
Select Banner as the type and click Add a placement. Then enter a Placement Name. Click the Create Placement button when done.
Interstitial
Select Interstitial as the type and click Add a placement. Then enter a Placement Name. Click the Create Placement button when done.
Rewarded
Select Rewarded as the type and click Add a placement. Then enter a Placement Name. Click the Create Placement button when done.
Native
Select Native as the type and click Add a placement. Then enter a Placement Name. Click the Create Placement button when done.
Account ID
Your InMobi account ID is available under Finance > Payment Settings > Payment Information.
API Key
In the InMobi Publisher Dashboard, go to My Account > Account Settings, click the API Key tab, and then Generate API Key.
Select the email of the user the key is required for and click Generate API Key. A file containing the API key and username/login name will be generated.
Only the publisher admin of the account will be able to generate an API key for all users. If you have forgotten the previously generated API key, reset your API key by hovering over your email on the API Key tab.
Step 2: Configure AdMob ad unit
First, sign in to your AdMob account. Next, follow the instructions below to create an AdMob ad unit and configure it to mediate for InMobi. If you plan to deploy your Unity app to both Android and iOS, you'll need to run through both the Android and iOS sections to create an AdMob ad unit for each platform.
AdMob UI Android
Navigate to the Mediation tab. If you have an existing mediation group you would like to modify, click the name of that mediation group to edit it, and skip ahead to Add InMobi 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 AdMob ad units. Then click Done.
Notice that the ad units card is now populated with the ad units you selected, as shown below:
Add InMobi as an ad source
In the Ad Sources card, select Add Ad Network.
Select InMobi and enable the Optimize switch. Enter your Login name and the API key with the username and API Key fields obtained in the previous section to set up ad source optimization for InMobi. Then enter an eCPM value for InMobi and click Continue.
Enter the Account ID and the Placement ID obtained in the previous section.
AdMob UI 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 InMobi 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 AdMob ad units. Then click Done.
Notice that the ad units card is now populated with the ad units you selected, as shown below:
Add InMobi as an ad source
In the Ad Sources card, select Add Ad Network.
Select InMobi and enable the Optimize switch. Enter your Login name and the API key obtained in the previous section to set up ad source optimization for InMobi. Then enter an eCPM value for InMobi, check the authorization checkbox, and click Continue.
Enter the Account ID and the Placement ID obtained in the previous 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 InMobi adapter passes back the reward specified in the InMobi dashboard when creating the placement.
For more information on setting reward values for AdMob ad units, refer to Create an ad unit.
Step 3: Import the InMobi SDK and adapter
Download the latest version of Google Mobile Ads mediation plugin for InMobi
from the download link in the
Changelog and extract
GoogleMobileAdsInMobiMediation.unitypackage
from the zip file.
In your Unity project editor, select Assets > Import Package > Custom
Package and select the GoogleMobileAdsInMobiMediation.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 perform dependency
resolution from scratch and copy the declared dependencies into the
Assets/Plugins/Android
directory of your Unity app.
Step 4: Add required additional code
No additional code required for InMobi integration.
Step 5: Test your implementation
Enable Test Mode for your placement on all live impressions or certain test devices only.
Optional steps
Android
Permissions
For optimal performance, InMobi recommends adding the following optional
permissions to your app's AndroidManifest.xml
file.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
You may optionally add these permissions to the
Plugins/Android/GoogleMobileAdsInMobiMediation/AndroidManifest.xml
file.
iOS
No additional steps required for iOS integration.
EU consent and GDPR
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 Google Mobile Ads mediation plugin for InMobi version 2.1.0 added the
InMobi.UpdateGDPRConsent()
method that lets you pass consent information to
InMobi. The following sample code shows how to pass consent information to the
InMobi SDK. If you choose to call this method, we recommend that you do so prior
to requesting ads with the Google Mobile Ads SDK.
using GoogleMobileAds.Api.Mediation.InMobi;
using System.Collections.Generic;
// ...
Dictionary<string, string> consentObject = new Dictionary<string, string>();
consentObject.Add("gdpr_consent_available", "true");
consentObject.Add("gdpr", "1");
InMobi.UpdateGDPRConsent(consentObject);
See InMobi's GDPR implementation details for more information about the possible keys and values that InMobi accepts in this consent object.
Add InMobi to GDPR ad partners list
Follow the steps in GDPR settings to add InMobi to the GDPR ad partners list in the AdMob UI.
CCPA
The California Consumer Privacy Act (CCPA) requires giving California state residents the right to opt out of the "sale" of their "personal information" (as the law defines those terms), with the opt-out offered via a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The CCPA preparation guide offers the ability to enable restricted data processing for Google ad serving, but Google is unable to apply this setting to each ad network in your mediation chain. Therefore, you must identify each ad network in your mediation chain that may participate in the sale of personal information and follow guidance from each of those networks to ensure compliance with CCPA.
See InMobi's CCPA documentation for guidelines on how to enable CCPA settings for InMobi.
Error codes
If the adapter fails to receive an ad from InMobi, publishers can check the
underlying error from the ad response using
ResponseInfo
under the following classes:
Android
com.google.ads.mediation.inmobi.InMobiAdapter
com.google.ads.mediation.inmobi.InMobiMediationAdapter
iOS
GADMAdapterInMobi
GADMediationAdapterInMobi
Here are the codes and accompanying messages thrown by the InMobi adapter when an ad fails to load:
Android
Error code | Reason |
---|---|
0-99 | InMobi SDK Errors. See code for more details. |
100 | InMobi server parameters configured in the AdMob UI are missing/invalid. |
101 | Failed to initialize the InMobi SDK. |
102 | The requested ad size does not match an InMobi supported banner size. |
103 | Ad request is not a unified native ad request. |
104 | Attempted to request an InMobi ad without initializing the InMobi SDK. This should in theory never happen since the adapter initializes the InMobi SDK prior to requesting InMobi ads. |
105 | InMobi's ad is not yet ready to be shown. |
106 | InMobi failed to display an ad. |
107 | InMobi returned a native ad that is missing a required asset. |
108 | InMobi's native ad image assets contain a malformed URL. |
109 | The adapter failed to download InMobi's native ad image assets. |
iOS
Error code | Reason |
---|---|
101 | InMobi server parameters configured in the AdMob UI are missing/invalid. |
102 | InMobi Adapter does not support the ad format being requested. |
103 | An InMobi ad is already loaded for this network configuration. |
Other | InMobi SDK returned an error. See IMRequestStatus.h for more details. |
InMobi Unity Mediation Plugin Changelog
Version 4.3.0 (In progress)
- Supports InMobi Android adapter version 10.5.4.0.
- Supports InMobi iOS adapter version 10.5.4.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.4.1.
Version 4.2.2
- Supports InMobi Android adapter version 10.1.2.1.
- Supports InMobi iOS adapter version 10.1.2.1.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.3.1.
Version 4.2.1
- Supports InMobi Android adapter version 10.1.2.0.
- Supports InMobi iOS adapter version 10.1.2.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.3.1.
Version 4.2.0
- Supports InMobi Android adapter version 10.1.1.0.
- Supports InMobi iOS adapter version 10.1.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.3.0.
Version 4.1.0
- Supports InMobi Android adapter version 10.0.9.0.
- Supports InMobi iOS adapter version 10.1.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.3.0.
Version 4.0.4
- Supports InMobi Android adapter version 10.0.7.0.
- Supports InMobi iOS adapter version 10.0.7.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.2.
Version 4.0.3
- Supports InMobi Android adapter version 10.0.5.0.
- Supports InMobi iOS adapter version 10.0.5.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 4.0.2
- Supports InMobi Android adapter version 10.0.3.0.
- Supports InMobi iOS adapter version 10.0.2.1.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 4.0.1
- Supports InMobi Android adapter version 10.0.3.0.
- Supports InMobi iOS adapter version 10.0.2.0.
Version 4.0.0
- Supports InMobi Android adapter version 10.0.1.0.
- Supports InMobi iOS adapter version 10.0.1.0.
Version 3.2.0
- Supports InMobi Android adapter version 9.2.0.0.
- Supports InMobi iOS adapter version 9.2.1.0.
Version 3.1.2
- Supports InMobi Android adapter version 9.1.9.0.
- Supports InMobi iOS adapter version 9.1.7.0.
Version 3.1.1
- Supports InMobi Android adapter version 9.1.1.0.
- Supports InMobi iOS adapter version 9.1.1.0.
Version 3.1.0
- Supports InMobi Android adapter version 9.1.0.0.
- Supports InMobi iOS adapter version 9.1.0.0.
Version 3.0.3
- Supports InMobi Android adapter version 9.0.7.1.
- Supports InMobi iOS adapter version 9.0.7.2.
Version 3.0.2
- Supports InMobi Android adapter version 9.0.7.0.
- Supports InMobi iOS adapter version 9.0.7.0.
Version 3.0.1
- Supports InMobi Android adapter version 9.0.6.0.
- Supports InMobi iOS adapter version 9.0.7.0.
Version 3.0.0
- Supports InMobi Android adapter version 9.0.4.0.
- Supports InMobi iOS adapter version 9.0.4.0.
Version 2.4.0
- Supports InMobi Android adapter version 7.3.0.1.
- Supports InMobi iOS adapter version 7.4.0.0.
Version 2.3.0
- Supports Android adapter version 7.2.9.0.
- Supports iOS adapter version 7.3.2.0.
Version 2.2.2
- Updated the plugin to support the new Rewarded API.
- Supports Android adapter version 7.2.7.0.
- Supports iOS adapter version 7.2.7.0.
Version 2.2.1
- Supports Android adapter version 7.2.2.0.
- Supports iOS adapter version 7.2.4.0.
Version 2.2.0
- Supports Android adapter version 7.2.1.0.
- Supports iOS adapter version 7.2.0.0.
Version 2.1.2
- Supports Android adapter version 7.1.1.1.
- Supports iOS adapter version 7.1.2.0.
Version 2.1.1
- Supports Android adapter version 7.1.1.1.
- Supports iOS adapter version 7.1.1.2.
Version 2.1.0
- Supports Android adapter version 7.1.0.0.
- Supports iOS adapter version 7.1.1.1.
- Added the
InMobi.UpdateGDPRConsent()
method.
Version 2.0.0
- Supports Android adapter version 7.0.4.0.
- Supports iOS adapter version 7.1.1.0.
Version 1.0.0
- First release!
- Supports Android adapter version 6.2.4.0.
- Supports iOS adapter version 6.2.1.0.