将 InMobi 与中介集成

This guide shows you how to use the Google Mobile Ads SDK to load and display ads from InMobi using mediation, covering both waterfall and bidding 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 Flutter app.

Supported integrations and ad formats

Integration
Bidding  1
Waterfall
Formats
Banner
Interstitial
Rewarded
Native  2

1 Bidding integration is in closed beta, reach out to your account manager to request access.

2 Supported only for waterfall mediation.

Requirements

  • Latest Google Mobile Ads SDK
  • Flutter 3.7.0 or higher
  • To deploy on Android
    • Android API level 21 or higher
  • To deploy on iOS
    • iOS deployment target of 10.0 or higher
  • A working Flutter project configured with Google Mobile Ads SDK. See Get Started for details.
  • Complete the mediation Get started guide

Step 1: Set up configurations in InMobi UI

注册 InMobi 帐号。

出价

选择将 InMobi SSP 与 Google 公开出价功能搭配使用,然后输入您的 Google 发布商 ID

瀑布

广告瀑布流集成无需执行额外步骤。

完成验证后,请登录到您的 InMobi 帐号。

添加应用

要将您的应用添加到 InMobi 信息中心,请依次点击商品目录 > 商品目录设置

点击添加广告资源,然后从下拉菜单中选择移动应用渠道。

首先在搜索栏中输入已发布的应用商店网址,然后从自动填充的结果中选择应用。点击继续

如果您的应用尚未发布,请点击手动关联,然后输入所需的详细信息。点击继续

查看应用和网站合规性设置,然后点击保存并创建展示位置

展示位置

当您设置好广告资源后,系统会将您重定向到展示位置创建工作流程。

出价

选择广告单元的类型。输入展示位置名称,分别为受众群体出价合作伙伴选择启用Google 公开出价,然后填写表单的其余部分。完成后,点击创建展示位置

瀑布

选择广告单元的类型。然后,输入展示位置名称,针对受众群体出价选择关闭,并填写表单的其余部分。完成后,点击创建展示位置

创建展示位置后,系统会显示其详细信息。记下展示位置 ID,该 ID 将用于设置您的AdMob 广告单元。

账号 ID

您可以在财务 > 付款设置 > 付款信息下找到您的 InMobi 帐号 ID。

找到 InMobi 报告 API 密钥

出价

出价集成不需要执行此步骤。

瀑布

转到我的帐号 > 帐号设置。前往 API 密钥标签页,然后点击生成 API 密钥

选择需要密钥的用户的电子邮件地址,然后点击生成 API 密钥。系统会生成一个包含 API 密钥和用户名/登录名的文件。

只有账号的发布者管理员才能为所有用户生成 API 密钥。如果您忘记了之前生成的 API 密钥,请将鼠标悬停在 API 密钥标签页上的邮件上,以重置 API 密钥。

开启测试模式

在所有实际展示上或仅在某些测试设备上为您的展示位置启用测试模式

Step 2: Set up InMobi demand in AdMob UI

为广告单元配置中介设置

Android

如需了解相关说明,请参阅 Android 指南中的第 2 步。

iOS

如需了解相关说明,请参阅 iOS 指南中的第 2 步。

Add InMobi to GDPR and US state regulations ad partners list

按照 GDPR 设置美国州级法规设置 中的步骤,将 InMobi 添加到 AdMob 界面中的 GDPR 和美国州级法规广告合作伙伴列表中。

Step 3: Import the InMobi SDK and adapter

通过 pub.dev 进行集成

在软件包的 pubspec.yaml 文件中,添加以下依赖项以及最新版本的InMobi SDK 和适配器:

dependencies:
  gma_mediation_inmobi: ^1.0.0

手动集成

InMobi 下载最新版本的 Google 移动广告中介插件,提取下载的文件,然后将提取的插件文件夹(及其内容)添加到您的 Flutter 项目中。然后,通过添加以下依赖项,在 pubspec.yaml 文件中引用该插件:

dependencies:
  gma_mediation_inmobi:
    path: path/to/local/package

Step 4: Implement privacy settings on InMobi SDK

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 does not support passing consent information to the InMobi SDK.

US states privacy laws

U.S. states privacy laws require giving users 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 U.S. states privacy laws compliance 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.

The Google Mobile Ads mediation plugin for InMobi does not support passing consent information to the InMobi SDK.

Step 5: Add required additional code

Android

No additional code is required InMobi integration.

iOS

SKAdNetwork integration

Follow InMobi's documentation to add the SKAdNetwork identifiers to your project's Info.plist file.

Step 6: Test your implementation

启用测试广告

请务必为AdMob 注册您的测试设备,并在 InMobi 界面中启用测试模式

验证测试广告

如需验证您收到的是来自InMobi的测试广告,请使用相应广告来源在广告检查器中启用单一广告来源测试InMobi (Bidding) and InMobi (Waterfall)

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.

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 Flutter Mediation Adapter Changelog

1.0.0

  • Initial release.
  • Verified compatibility with InMobi Android adapter version 10.6.7.1.
  • Verified compatibility with InMobi iOS adapter version 10.7.2.0.
  • Built and tested with the Google Mobile Ads Flutter Plugin version 5.1.0.