Documentation

AdMob Bidding

👍

Full Technical Documentation

To get full documentation and samples please refer to the GitHub page.

Integration

🚧

Requirements:

Min Android SDK version - 21 (5.0 Lollipop)

repositories {
    // Add BidMachine maven repository
    maven {
        name "BidMachine Ads maven repository"
        url "https://artifactory.bidmachine.io/bidmachine"
    }
}

dependencies {
    // Add BidMachine SDK dependency
    implementation "io.bidmachine:ads:3.1.1"
    // Add BidMachine SDK AdMob Adapter dependency
    implementation "io.bidmachine:ads.adapters.admob:3.1.1.40"
    // Add AdMob SDK dependency
    implementation "com.google.android.gms:play-services-ads:23.6.0"
}

Initialization

Waterfall

Waterfall integration does not require BidMachineSdk initialization code, as it is triggered automatically as part of the MobileAds initialization.

MobileAds.initialize(context, new OnInitializationCompleteListener() {
    @Override
    public void onInitializationComplete (InitializationStatus initializationStatus){
        // Request ads
    }
});
MobileAds.initialize(context) {
    // Optionally, enable test mode and logging
    BidMachine.setTestMode(true)
    BidMachine.setLoggingEnabled(true)
}

Prebid

🚧

Warning

Before AdMob SDK initialization, you should start the BidMachine SDK.

BidMachine.initialize(context, BID_MACHINE_SOURCE_ID, new InitializationCallback() {
    @Override
    public void onInitialized () {
        MobileAds.initialize(context, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
                // Request ads
            }
        });
    }
});
// Optionally, enable test mode and logging
BidMachine.setLoggingEnabled(true)
BidMachine.initialize(context, BID_MACHINE_SOURCE_ID) {
    MobileAds.initialize(context) {
        ...
    }
}

Logging and Test Mode

BidMachine.setTestMode(true);
BidMachine.setLoggingEnabled(true);
BidMachine.setTestMode(true);
BidMachine.setLoggingEnabled(true);

❗️

Don't forget to remove setTestMode() before releasing to production!

Additional Configuration

If you need to configure additional BidMachineSdk settings, refer to the documentation.

GDPR & CCPA

GDPR

Publisher needs to send a boolean flag indicating if the GDPR applies to the current user.
If so, the Publisher also needs to collect user consent prior to requesting any ad from the Exchange server. You can find more information on collecting consent here.

SDK has public methods to transfer the GDPR data. Also, SDK automatically retrieves GDPR from SharedPreference. If you would like to pass GDPR according to IAB standards, please add it in SharedPreference.

When using several data transfer methods at the same time, priority is given to the SDK public method, then TCF 2.0, then TCF 1.0.

Some adapters don't have a public API for the GDPR data to be passed to them. Such adapters will read GDPR from the SharedPreference.

GDPR Applies

BidMachine.setSubjectToGDPR(<GDPR APPLIES>);
BidMachine.setSubjectToGDPR(<GDPR APPLIES>)

TCF 2.0

PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putInt("IABTCF_gdprApplies", <GDPR APPLIES>)
        .apply();
PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putInt("IABTCF_gdprApplies", <GDPR APPLIES>)
        .apply()

TCF 1.0

PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABConsent_SubjectToGDPR", "<GDPR APPLIES>")
        .apply();
PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABConsent_SubjectToGDPR", "<GDPR APPLIES>")
        .apply()

GDPR Consent String

BidMachine.setConsentConfig(..., "<GDPR CONSENT STRING>");

TCF 2.0

PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABTCF_TCString", "<GDPR CONSENT STRING>")
        .apply();
PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABTCF_TCString", "<GDPR CONSENT STRING>")
        .apply()

TCF 1.0

PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABConsent_ConsentString", "<GDPR CONSENT STRING>")
        .apply();
PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABConsent_ConsentString", "<GDPR CONSENT STRING>")
        .apply()

CCPA

To pass CCPA U.S. Privacy String to BidMachine use:

BidMachine.setUSPrivacyString("<IAB CCPA U.S. PRIVACY STRING>");
BidMachine.setUSPrivacyString("<IAB CCPA U.S. PRIVACY STRING>")

Also, SDK automatically retrieves CCPA U.S. Privacy String from SharedPreference. If you would like to pass CCPA U.S. Privacy String according to IAB standards, please add it in SharedPreference. More information here and here.

PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABUSPrivacy_String", "<IAB CCPA U.S. PRIVACY STRING>")
        .apply();
PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putString("IABUSPrivacy_String", "<IAB CCPA U.S. PRIVACY STRING>")
        .apply()

Some adapters don't have a public API for the CCPA U.S. Privacy String to be passed to them. Such adapters read this from the SharedPreference.

Ad Format

Next, choose the ad format that best fits your app’s user experience.