Tích hợp ironSource với tính năng Dàn xếp

This guide shows you how to use the Google Mobile Ads SDK to load and display ads from ironSource using mediation, covering waterfall integrations. It covers how to add ironSource to an ad unit's mediation configuration, how to set up ad source optimization, and how to integrate the ironSource SDK and adapter into your Android app.

Supported integrations and ad formats

The AdMob mediation adapter for ironSource has the following capabilities:

Integration
Bidding
Waterfall
Formats
Banner
Interstitial
Rewarded
Rewarded Interstitial
Native

Requirements

  • Android API level 19 or higher
  • Latest Google Mobile Ads SDK

Step 1: Set up ironSource

Sign up and sign in to your ironSource account.

To add your application to the ironSource dashboard, click the New App button.

Enter app details

Select Mobile App, enter the Google Play URL of your app, and click Import App Info. Once your app information is displayed, click the Add App button.

If your app is not available, select App Not Live in the Application Store and provide a Temporary Name for your app. Select Android as platform and click Add App.

Take note of your new App Key, which is displayed after the app has been added. You will need this value for setting up your AdMob ad unit ID. Select the ad formats your app supports in the appropriate Live tabs. Then click Done.

Instance ID

Next, configure a network instance for the app you added; ironSource supports multiple network instances for rewarded and interstitial ads.

Navigate to the Ad Units & Placements page from the left nav, select your app in the APPLICATIONS list and click the Edit button.

Select the Add Network Instance link, enter an Instance Name, and click Save.

Once the instance is created, the Instance ID is listed in the Instance Id field.

In addition to the App Key and Instance ID, you'll also need your ironSource Secret Key and Refresh Token to set up your AdMob ad unit ID.

Navigate to My Account in your ironSource publisher dashboard then click the API tab. Take note of your Secret Key and Refresh Token.

Step 2: Configure mediation settings for your AdMob ad unit

To add ironSource to the mediation configuration for your ad unit, first sign in to your AdMob account.

Next, 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 ironSource 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 and click Add Ad Units.

Associate this mediation group with one or more of your existing AdMob ad units. Then click Done.

You should now see the ad units card populated with the ad units you selected as shown below:

Add ironSource as an ad source

In the Ad Sources card, select Add Ad Network. Then select ironSource.

Next, enable the Optimize feature, then enter the Secret Key and Refresh Token obtained in previous section to set up ad source optimization for ironSource. Then enter an eCPM value and click Continue.

If you already have a mapping for ironSource, you can simply select it. Otherwise, click Add mapping.

Next, enter a Mapping name, the App Key and Instance ID obtained in the previous section. Then click Done.

Rewarded ads

In the settings for your rewarded 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 Apply to all networks in Mediation groups box.

If you don't apply this setting, the ironSource adapter passes back the reward specified in the ironSource dashboard when creating the placement.

For more information on setting reward values for AdMob ad units, see Create an ad unit.

Step 3: Import the ironSource SDK and adapter

Add the following ironSource Maven repository and implementation dependency with the latest version of the ironSource SDK and adapter in the app-level build.gradle file:

repositories {
    google()
    mavenCentral()
    maven {
        url 'https://android-sdk.is.com/'
    }
}

// ...
dependencies {
    implementation 'com.google.android.gms:play-services-ads:22.1.0'
    implementation 'com.google.ads.mediation:ironsource:7.3.0.1.0'
}
// ...

Manual Integration

  1. Download the latest version of the ironSource Android SDK and add it to your project.

  2. Navigate to the IronSource adapter artifacts on Google's Maven Repository. Select the latest version, download the IronSource adapter's .aar file, and add it to your project.

Step 4: Additional code required

Application lifecycle

Override the onPause() and onResume() methods in each of your activities to call the corresponding ironSource methods as follows:

Java

@Override
public void onResume() {
    super.onResume();
    IronSource.onResume(this);
}

@Override
public void onPause() {
    super.onPause();
    IronSource.onPause(this);
}

Kotlin

public override fun onResume() {
    super.onResume()
    IronSource.onResume(this)
}

public override fun onPause() {
    super.onPause()
    IronSource.onPause(this)
}

Proguard Rules

If you shrink, obfuscate, and optimize your app , IronSource requires additional ProGuard rules to your project. Consult IronSource's Android SDK Integration guide for more information.

Step 5: Test your implementation

To enable test ads on ironSource, run your ads integrated app and check the logs for a message that looks like this:

Copy your GAID (which is your device's Advertising ID) to your clipboard.

Navigate to the MONETIZE tab and click the Testing button. Next, click the New Test Device button.

Enter the Device Name and Advertising ID (from the previous step). Then click Save.

The newly added test device is listed under TEST DEVICES. You can activate or deactivate Test Ads in this module as required.

Optional steps

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.

In SDK version 6.7.9, ironSource added a consent API. The following sample code shows how to pass this consent information to the ironSource SDK. If you choose to call this method, it is recommended that you do so prior to requesting ads through the Google Mobile Ads SDK.

Java

import com.ironsource.mediationsdk.IronSource;
// ...

IronSource.setConsent(true);

Kotlin

import com.ironsource.mediationsdk.IronSource
// ...

IronSource.setConsent(true)

See ironSource's documentation on Regulation Advanced Settings for more details and the values that can be provided in the method.

Add ironSource to GDPR ad partners list

Follow the steps in GDPR settings to add ironSource Mobile 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.

In SDK version 6.14.0, ironSource added an API to support CCPA regulations. The following sample code shows how to pass this consent information to the ironSource SDK. These options must be set before you initialize the Google Mobile Ads SDK to ensure they get forwarded properly to the ironSource SDK.

Java

import com.ironsource.mediationsdk.IronSource;
// ...

IronSource.setMetaData("do_not_sell", "true");

Kotlin

import com.ironsource.mediationsdk.IronSource
// ...

IronSource.setMetaData("do_not_sell", "true")

See ironSource's documentation on Regulation Advanced Settings for more details and the values that can be provided in the method.

Error codes

If the adapter fails to receive an ad from ironSource, you can check the underlying error from the ad response using ResponseInfo.getAdapterResponse() under the following classes:

com.google.ads.mediation.ironsource.IronSourceAdapter
com.google.ads.mediation.ironsource.IronSourceRewardedAdapter

Here are the codes and accompanying messages thrown by the ironSource adapter when an ad fails to load:

Error code Reason
101 ironSource server parameters configured in the AdMob UI are missing/invalid.
102 ironSource requires an Activity context to initialize their SDK.
103 ironSource can only load 1 ad per ironSource instance ID.
501-1056 ironSource SDK Errors. See documentation for more details.

IronSource Android Mediation Adapter Changelog

Version 7.3.0.1.0

  • Verified compatibility with ironSource SDK version 7.3.0.1.

Built and tested with:

  • Google Mobile Ads SDK version 22.0.0.
  • IronSource SDK version 7.3.0.1.

Version 7.3.0.0

  • Verified compatibility with ironSource SDK version 7.3.0.
  • Updated adapter to use new VersionInfo class.
  • Updated the minimum required Google Mobile Ads SDK version to 22.0.0.

Built and tested with:

  • Google Mobile Ads SDK version 22.0.0.
  • IronSource SDK version 7.3.0.

Version 7.2.7.0

  • Verified compatibility with ironSource SDK version 7.2.7.
  • Updated the minimum required Google Mobile Ads SDK version to 21.4.0.

Built and tested with:

  • Google Mobile Ads SDK version 21.4.0.
  • IronSource SDK version 7.2.7.

Version 7.2.6.0

  • Verified compatibility with ironSource SDK version 7.2.6.

Built and tested with:

  • Google Mobile Ads SDK version 21.3.0.
  • IronSource SDK version 7.2.6.

Version 7.2.5.0

  • Verified compatibility with ironSource SDK version 7.2.5.
  • Updated the minimum required Google Mobile Ads SDK version to 21.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 21.3.0.
  • IronSource SDK version 7.2.5.

Version 7.2.3.1.0

  • Verified compatibility with ironSource SDK version 7.2.3.1.

Built and tested with:

  • Google Mobile Ads SDK version 21.0.0.
  • IronSource SDK version 7.2.3.1.

Version 7.2.3.0

  • Verified compatibility with ironSource SDK version 7.2.3.

Built and tested with:

  • Google Mobile Ads SDK version 21.0.0.
  • IronSource SDK version 7.2.3.

Version 7.2.2.1.0

  • Verified compatibility with ironSource SDK version 7.2.2.1.

Built and tested with:

  • Google Mobile Ads SDK version 21.0.0.
  • IronSource SDK version 7.2.2.1.

Version 7.2.2.0

  • Verified compatibility with ironSource SDK version 7.2.2.
  • Updated compileSdkVersion and targetSdkVersion to API 31.
  • Updated the minimum required Google Mobile Ads SDK version to 21.0.0.
  • Updated the minimum required Android API level to 19.

Built and tested with:

  • Google Mobile Ads SDK version 21.0.0.
  • IronSource SDK version 7.2.2.

Version 7.2.1.1.0

  • Verified compatibility with ironSource SDK version 7.2.1.1.

Built and tested with:

  • Google Mobile Ads SDK version 20.6.0.
  • IronSource SDK version 7.2.1.1.

Version 7.2.1.0

  • Verified compatibility with ironSource SDK version 7.2.1.
  • Updated the minimum required Google Mobile Ads SDK version to 20.6.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.6.0.
  • IronSource SDK version 7.2.1.

Version 7.2.0.0

  • Verified compatibility with ironSource SDK version 7.2.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.5.0.
  • IronSource SDK version 7.2.0.

Version 7.1.14.0

  • Verified compatibility with ironSource SDK version 7.1.14.

Built and tested with:

  • Google Mobile Ads SDK version 20.5.0.
  • IronSource SDK version 7.1.14.

Version 7.1.13.0

  • Verified compatibility with ironSource SDK version 7.1.13.
  • Updated the adapter to use new AdError API.

Built and tested with:

  • Google Mobile Ads SDK version 20.5.0.
  • IronSource SDK version 7.1.13.

Version 7.1.12.2.0

  • Verified compatibility with ironSource SDK version 7.1.12.2.
  • Updated the minimum required Google Mobile Ads SDK version to 20.5.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.5.0.
  • IronSource SDK version 7.1.12.2.

Version 7.1.12.1.0

  • Verified compatibility with ironSource SDK version 7.1.12.1.

Built and tested with:

  • Google Mobile Ads SDK version 20.4.0.
  • IronSource SDK version 7.1.12.1.

Version 7.1.12.0

  • Verified compatibility with ironSource SDK version 7.1.12.

Built and tested with:

  • Google Mobile Ads SDK version 20.4.0.
  • IronSource SDK version 7.1.12.

Version 7.1.11.1.0

  • Verified compatibility with ironSource SDK version 7.1.11.1.

Built and tested with:

  • Google Mobile Ads SDK version 20.4.0.
  • IronSource SDK version 7.1.11.1.

Version 7.1.11.0

  • Verified compatibility with ironSource SDK version 7.1.11.
  • Updated the minimum required Google Mobile Ads SDK version to 20.4.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.4.0.
  • IronSource SDK version 7.1.11.

Version 7.1.10.0

  • Verified compatibility with ironSource SDK version 7.1.10.

Built and tested with:

  • Google Mobile Ads SDK version 20.3.0.
  • IronSource SDK version 7.1.10.

Version 7.1.9.0

  • Verified compatibility with ironSource SDK version 7.1.9.
  • Updated the minimum required Google Mobile Ads SDK version to 20.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.3.0.
  • IronSource SDK version 7.1.9.

Version 7.1.8.0

  • Verified compatibility with ironSource SDK version 7.1.8.

Built and tested with:

  • Google Mobile Ads SDK version 20.2.0.
  • IronSource SDK version 7.1.8.

Version 7.1.7.0

  • Verified compatibility with ironSource SDK version 7.1.7.
  • Updated the minimum required Google Mobile Ads SDK version to 20.2.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.2.0.
  • IronSource SDK version 7.1.7.

Version 7.1.6.1.0

  • Verified compatibility with ironSource SDK version 7.1.6.1.
  • Updated the minimum required Google Mobile Ads SDK version to 20.2.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.2.0.
  • IronSource SDK version 7.1.6.1.

Version 7.1.6.0

  • Verified compatibility with ironSource SDK version 7.1.6.

Built and tested with:

  • Google Mobile Ads SDK version 20.1.0.
  • IronSource SDK version 7.1.6.

Version 7.1.5.1.0

  • Verified compatibility with ironSource SDK version 7.1.5.1.

Built and tested with:

  • Google Mobile Ads SDK version 20.0.0.
  • IronSource SDK version 7.1.5.1.

Version 7.1.5.0

  • Verified compatibility with ironSource SDK version 7.1.5.
  • Updated the minimum required Google Mobile Ads SDK version to 20.0.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.0.0.
  • IronSource SDK version 7.1.5.

Version 7.1.4.0

  • Verified compatibility with ironSource SDK version 7.1.4.

Built and tested with:

  • Google Mobile Ads SDK version 19.8.0.
  • IronSource SDK version 7.1.4.

Version 7.1.3.0

  • Verified compatibility with ironSource SDK version 7.1.3.
  • Updated the minimum required Google Mobile Ads SDK version to 19.8.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.8.0.
  • IronSource SDK version 7.1.3.

Version 7.1.2.0

  • Added support for rewarded interstitial ads.
  • Verified compatibility with ironSource SDK version 7.1.2.

Built and tested with:

  • Google Mobile Ads SDK version 19.7.0.
  • IronSource SDK version 7.1.2.

Version 7.1.0.2.0

  • Verified compatibility with ironSource SDK version 7.1.0.2.

Built and tested with:

  • Google Mobile Ads SDK version 19.7.0.
  • IronSource SDK version 7.1.0.2.

Version 7.1.0.1.0

  • Verified compatibility with ironSource SDK version 7.1.0.1.
  • Updated the minimum required Google Mobile Ads SDK version to 19.7.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.7.0.
  • IronSource SDK version 7.1.0.1.

Version 7.0.4.1.0

  • Verified compatibility with ironSource SDK version 7.0.4.1.
  • Updated the minimum required Google Mobile Ads SDK version to 19.6.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.6.0.
  • IronSource SDK version 7.0.4.1.

Version 7.0.4.0

  • Verified compatibility with ironSource SDK version 7.0.4.

Built and tested with:

  • Google Mobile Ads SDK version 19.5.0.
  • IronSource SDK version 7.0.4.

Version 7.0.3.1.0

  • Verified compatibility with ironSource SDK version 7.0.3.1.
  • Updated the minimum required Google Mobile Ads SDK version to 19.5.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.5.0.
  • IronSource SDK version 7.0.3.1.

Version 7.0.2.0

  • Verified compatibility with ironSource SDK version 7.0.2.
  • Updated the minimum required Google Mobile Ads SDK version to 19.4.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.4.0.
  • IronSource SDK version 7.0.2.

Version 7.0.1.1.0

  • Verified compatibility with ironSource SDK version 7.0.1.1.

Built and tested with:

  • Google Mobile Ads SDK version 19.3.0.
  • IronSource SDK version 7.0.1.1.

Version 7.0.0.0

  • Verified compatibility with ironSource SDK version 7.0.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.3.0.
  • IronSource SDK version 7.0.0.

Version 6.18.0.0

  • Verified compatibility with ironSource SDK version 6.18.0.
  • Updated the minimum required Google Mobile Ads SDK version to 19.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.3.0.
  • IronSource SDK version 6.18.0.

Version 6.17.0.1

  • Added descriptive error codes and reasons for adapter load/show failures.
  • Updated the minimum required Google Mobile Ads SDK version to 19.2.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.2.0.
  • IronSource SDK version 6.17.0.

Version 6.17.0.0

  • Verified compatibility with ironSource SDK version 6.17.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.1.0.
  • IronSource SDK version 6.17.0.

Version 6.16.2.0

  • Verified compatibility with ironSource SDK version 6.16.2.

Built and tested with:

  • Google Mobile Ads SDK version 19.1.0.
  • IronSource SDK version 6.16.2.

Version 6.16.1.0

  • Verified compatibility with ironSource SDK version 6.16.1.
  • Updated the minimum required Google Mobile Ads SDK version to 19.1.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.1.0.
  • IronSource SDK version 6.16.1.

Version 6.16.0.0

  • Verified compatibility with ironSource SDK version 6.16.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.0.1.
  • IronSource SDK version 6.16.0.

Version 6.15.0.1.0

  • Verified compatibility with ironSource SDK version 6.15.0.1.
  • Updated the minimum required Google Mobile Ads SDK version to 19.0.1.

Built and tested with:

  • Google Mobile Ads SDK version 19.0.1.
  • IronSource SDK version 6.15.0.1.

Version 6.15.0.0

  • Verified compatibility with ironSource SDK version 6.15.0.
  • Updated the minimum required Google Mobile Ads SDK version to 19.0.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.0.0.
  • IronSource SDK version 6.15.0.

Version 6.14.0.1.0

  • Verified compatibility with ironSource SDK version 6.14.0.1.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • IronSource SDK version 6.14.0.1.

Version 6.14.0.0

  • Verified compatibility with ironSource SDK version 6.14.0.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • IronSource SDK version 6.14.0.

Version 6.13.0.1.0

  • Verified compatibility with ironSource SDK version 6.13.0.1.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • IronSource SDK version 6.13.0.1.

Version 6.12.0.0

  • Verified compatibility with ironSource SDK version 6.12.0.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • IronSource SDK version 6.12.0.

Version 6.11.0.0

  • Verified compatibility with ironSource SDK version 6.11.0.
  • Updated the minimum required Google Mobile Ads SDK version to 18.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • IronSource SDK version 6.11.0.

Version 6.10.0.0

  • Verified compatibility with ironSource SDK version 6.10.0.
  • Updated the minimum required Google Mobile Ads SDK version to 18.2.0.

Version 6.9.1.0

  • Verified compatibility with ironSource SDK version 6.9.1.

Version 6.9.0.1

  • Fixed ironSource adapter to remove it's lock on an instance ID.
  • Updated the minimum required Google Mobile Ads SDK version to 18.1.1.

Version 6.9.0.0

  • Verified compatibility with ironSource SDK version 6.9.0.
  • Updated the minimum required Google Mobile Ads SDK version to 18.1.0.

Version 6.8.4.1

  • Added support to request multiple interstitial ads.

Version 6.8.4.0

  • Verified compatibility with ironSource SDK version 6.8.4.

Version 6.8.1.2

  • Fixed an issue where loading rewarded ads always failed to load if an interstitial ad was loaded first.

Version 6.8.1.1

  • Updated adapter to support new open-beta Rewarded API.
  • Updated the minimum required Google Mobile Ads SDK version to 17.2.0.

Version 6.8.1.0

  • Verified compatibility with ironSource SDK version 6.8.1.

Version 6.7.12.0

  • Verified compatibility with ironSource SDK version 6.7.12.

Version 6.7.11.0

  • Verified compatibility with ironSource SDK version 6.7.11.

Version 6.7.10.0

  • Verified compatibility with ironSource SDK version 6.7.10.

Version 6.7.9.1.1

  • Updated the adapter to invoke the onRewardedVideoComplete() ad event.

Version 6.7.9.1.0

  • Verified compatibility with ironSource SDK version 6.7.9.1.

Version 6.7.9.0

  • Verified compatibility with ironSource SDK version 6.7.9.

Version 6.7.8.0

  • Verified compatibility with ironSource SDK version 6.7.8.

Version 6.7.7.0

  • Initialize IronSource SDK once per ad unit.
  • Added option to pass activity to IronSource SDK in onPause and onResume methods.
  • Verified compatibility with ironSource SDK version 6.7.0.

Version 6.7.5.0

  • Initial release.