This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from InMobi via mediation.
It covers how to add InMobi ads to an ad unit's mediation configuration, how to set up Automatic data collection, and how to integrate the InMobi SDK and adapter into an iOS app.
Supported formats and features
The Google Ad Manager mediation adapter for InMobi has the following capabilities:
|Rewarded Video (new APIs)|
|Native Ads - Custom Rendering|
|Automatic data collection|
- iOS deployment target of 8.0 or higher
- Latest Google Mobile Ads SDK
Step 1: Set up InMobi
Add an app
Click the Add an App button to add your app to InMobi.
Enter your app's URL and click the Look Up button. Otherwise click Have an app that isn't yet published?
Enter the name of your app and choose iOS as the Platform. Select whether or not your app is COPPA compliant and click Add App when done.
InMobi requires you to create a placement before you finish adding your app.
Select BANNER as the type and enter a Placement Name. Click the Create Placement button when done.
Once the placement is created, its details are shown. Take note of the Placement ID, which will be used for setting up your Ad Manager ad unit.
Select INTERSTITIAL as the type and enter a Placement Name for your placement. Click the Create Placement button when done.
Once the placement is created, the placement details are are shown. Take note of the Placement ID, which will be used for setting up your Ad Manager ad unit.
Select REWARDED VIDEO as the type and enter a Placement Name for your placement. Click the Create Placement button when done.
Once the placement is created, its details are are shown. Take note of the Placement ID, which will be used later to set up your Ad Manager ad unit. Enter values for Key and Value for the reward details.
Select NATIVE CONTENT as the type and enter a Placement Name for your placement. Click the Create Placement button when done.
Once the placement is created, its details are are shown. Take note of the Placement ID, which will be used later to set up your Ad Manager ad unit. Select either PREROLL, STREAM, or SPLASH as the Native Ad Layout style and click Customize.
The FEED Native Ad Layout does not contain some of the assets that are required by Google Mobile Ads SDK and the adapter would fail the ad request if one of the required assets is missing.
Select the desired size for Screenshots (main image), then click Save.
Now that the placement has been created, click Proceed to Integration, then click Done.
Next, you will get your Account ID, which can be found by clicking on your email address (located in the top-right corner of your InMobi dashboard).
In addition to your Account ID and Placement ID you need a secret key provided by InMobi. Contact the InMobi support team to obtain your key.
Step 2: Configure mediation settings for your Ad Manager ad unit
Sign in to your Ad Manager account. Navigate to Delivery > Yield groups and click the New yield group button.
Enter a unique Name for your yield group, set the Status to Active, select your Ad Format, and set the Inventory type to Mobile App. Under the Targeting > Inventory section, select the Ad Unit ID to which you want to add mediation.
Next, click the Add yield partner button.
If you already have a Yield partner for InMobi, you can simply select it. Otherwise, select Create a new yield partner.
Select InMobi as the Ad network and enter a unique Name. Enable Mediation and turn on Automatic data collection, and enter the Secret Key obtained from InMobi support. Next, enter your Username and click Save when done.
Once the Yield partner is selected, choose Mobile SDK mediation as the Integration type, iOS as the Platform, and Active as the Status. Enter the Account ID and the Placement ID obtained in the previous section and a Default CPM value.
Click Save at the bottom of the page when done.
Using rewarded video ads
In the settings for your rewarded video ad unit, provide values for the reward amount and reward type. Then, to ensure you provide the same reward to the user no matter which ad network is served, check the Override reward settings from third-party ad networks when using mediation box.
If you don't apply this setting, the InMobi adapter passes back the reward specified in the InMobi dashboard when creating the placement.
Step 3: Import the InMobi SDK and adapter
Using CocoaPods (recommended)
Add the following line to your project's Podfile:
From the command line run:
pod install --repo-update
- Download the latest version of the InMobi iOS SDK
InMobiSDK.frameworkin your project.
- Download the latest version of the
InMobiAdapter.frameworkin your project.
- Add the following Frameworks to your project
-ObjC flag to the Other Linker Flags under
Application Target > Build Settings.
Step 4: Additional code required
No additional code is required for InMobi integration.
Step 5: Test your implementation
To enable test ads for a placement, go to your app's details page by clicking on your app's name in the InMobi dashboard and navigate to the Placements tab located in the left navigation bar. Select the placement for which you want to enable test ads and click on the Diagnostics section to expand it.
You can choose either Global ON or Selective ON as the Test Mode. If you select Selective ON, you need to add a test device. Make sure that InMobi Test Ad is selected as the Test ad.
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 section below shows you how to enable or disable personalized ads for InMobi.
In version 18.104.22.168, the InMobi adapter added the
GADMInMobiConsent class that
allows you to pass consent information to InMobi. The following sample code
updateGDPRConsent: on the
GADMInMobiConsent class. If you choose to
call this method, it is recommended that you do so prior to requesting ads via
the Google Mobile Ads SDK.
#import <InMobiAdapter/InMobiAdapter.h> ... NSMutableDictionary *consentObject = [[NSMutableDictionary alloc] init]; [consentObject setObject:@"1" forKey:@"gdpr"]; [consentObject setObject:@"true" forKey:IM_GDPR_CONSENT_AVAILABLE]; [GADMInMobiConsent updateGDPRConsent:consentObject];
See InMobi's GDPR implementation details for more information about the possible keys and values that InMobi accepts in this consent object.
The InMobi adapter supports additional request parameters that can be passed to
the adapter using the
GADInMobiExtras includes the
following properties common for all supported ad formats:
|Request parameters and values|
The user's age group.
The education level of the user.
||Integer. The user's age.|
||Integer. The user's year of birth.|
||String. The user's postal code. Usually a five-digit number.|
||String. The user's telephone area code (part of the phone number).|
||String. The user's native language (if known).|
||String. A login ID in the publisher's domain.|
||String. A session ID in the publisher's domain.|
||String. Location with city, state, and country as parameters.|
||String. Any contextually relevant keywords to be passed in the ad request.|
||String. Any contextually relevant strings to be passed in the ad request.|
||Dictionary. Any additional values to be passed in the ad request.|
Here's a code example of how to set these ad request parameters:
let request = DFPRequest() let extras = GADInMobiExtras() extras.ageGroup = kIMSDKAgeGroupBetween35And54 extras.areaCode = "12345" ... request.registerAdNetworkExtras(extras)
DFPRequest *request = [DFPRequest request]; GADInMobiExtras *extras = [[GADInMobiExtras alloc] init]; extras.ageGroup = kIMSDKAgeGroupBetween35And54; extras.areaCode = @"12345"; ... [request registerAdNetworkExtras:extras];
Using native ads
Ad renderingThe InMobi adapter returns its native ads as
GADUnifiedNativeAdobjects. It populates the fields described in Custom native ad formats for a
|Field||Assets always included by InMobi adapter|
|Call to action|
Impression and click tracking
Clicks are detected by the Google Mobile Ads SDK and are forwarded to InMobi, so click reporting will be in sync.
The Google Mobile Ads SDK uses the InMobi SDK's callbacks for impression tracking, so the reports on both dashboards should match up with few to no discrepancies.
InMobi does not provide an image asset for any native ads (video or static). For non-video ads, InMobi's SDK populates its media view with an image asset instead. To avoid potential null pointer errors, the InMobi adapter automatically creates a blank GADNativeAdImage and includes it in the images asset array that's part of the ad object received by the app.
Publishers mediating to InMobi are encouraged to avoid using the image assets directly, and instead use GADMediaView in their UI. Ads loaded via the InMobi adapter will always provide a media view, which will automatically display video assets for ads that contain them and an image asset for ads that don't.
InMobi iOS Mediation Adapter Changelog
- Verified compatibility with InMobi SDK 9.0.7.
Built and tested with
- Google Mobile Ads SDK version 7.60.0.
- InMobi SDK version 9.0.7.
- Verified compatibility with InMobi SDK 9.0.6.
- Updated InMobi iOS adapter CocoaPod dependency to use
- Now requires Google Mobile Ads SDK version 7.60.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.60.0
- InMobi SDK version 9.0.6
- Verified compatibility with InMobi SDK 9.0.4.
- Adapter now fails early when InMobi SDK initialization fails.
- Removed support for the i386 architecture.
Built and tested with
- Google Mobile Ads SDK version 7.57.0
- InMobi SDK version 9.0.4
- Verified compatibility with InMobi SDK 9.0.0.
- Removed open bidding capability for banner, interstitial, and rewarded formats.
Built and tested with
- Google Mobile Ads SDK version 7.53.1
- InMobi SDK version 9.0.0
- Verified compatibility with InMobi SDK 7.4.0.
- Fixed an issue where the adapter fails to initialize due to invalid mediation configurations.
- Verified compatibility with InMobi SDK 7.3.2.
- Added open bidding capability to the adapter for banner, interstitial and rewarded ad formats.
- Verified compatibility with InMobi SDK 7.3.0.
- Removed support for Native Content and App Install ad requests. Apps must use the Unified Native Ads API to request native ads.
- Now requires Google Mobile Ads SDK version 7.46.0 or higher.
- Verified compatibility with InMobi SDK 7.2.7.
- Updated the adapter to use the new rewarded API.
- Now requires Google Mobile Ads SDK version 7.42.2 or higher.
- Added support for flexible banner ad sizes.
- Verified compatibility with InMobi SDK 7.2.4.
- Verified compatibility with InMobi SDK 7.2.1.
- Verified compatibility with InMobi SDK 7.2.0.
- Verified compatibility with InMobi SDK 7.1.2.
adapterDidCompletePlayingRewardBasedVideoAd:callback to the adapter.
- Added the
GADInMobiConsentclass which provides
- Verified compatibility with InMobi SDK 7.1.1.
- Verified compatibility with InMobi SDK 7.1.0.
- Fixed an issue causing duplicate symbol errors when the adapter was used with those of other networks.
- Updated the adapter to make it compatibility with InMobi SDK 7.0.4.
- Added support for native video ads.
- InMobi's SDK does not provide images for ads containing video assets. To avoid potential NullPointerExceptions, when the adapter receives one of these ads it will automatically create a blank NativeAd.Image and include it in the images asset array in the ad object received by the app. Publishers using this adapter are encouraged to avoid using the image assets directly when mediating to InMobi, and instead use GADMediaView in their UI. GADMediaView will automatically display video assets for ads that contain them, and an image asset for ads that don't.
- Verified compatibility with inMobi SDK 6.2.1
- Support for banners, interstitials, rewarded video and native ad formats.