Prebid Mobile SDK in Apps

From Documentation
Revision as of 10:51, 30 January 2026 by Mhabibi2 (talk | contribs)
Jump to navigation Jump to search

Introduction

The Prebid Mobile SDK is used to integrate various HeaderBidding providers into an app, which then bid on the available ad placements during initial page load. The winning bid is then passed to the Google Mobile Ads SDK (GMA SDK) to the ad server, which compares the bid with other bookings available there and delivers the most appropriate booking.

Note: The implementation guide uses code snippets for Android as examples and assumes that the Google Mobile Ads SDK is already integrated into the app. Basic documentation of Prebid Mobile can be found here:

Step 1 - Integrate Prebid Mobile SDK

iOS: https://github.com/prebid/prebid-mobile-ios Android: https://github.com/prebid/prebid-mobile-android

Step 2 - Initial global configuration

At the beginning, the endpoint and account ID must be set in the SDK and placed in an initialization method

Example

PrebidMobile.setPrebidServerAccountId("<<<PREBID_SERVER_ACCOUNT_ID>>>") 

PrebidMobile.setCustomStatusEndpoint("https://client-pbs.relevant-digital.com/s  
tatus")  

PrebidMobile.initializeSdk(  
    applicationContext,  
    "https://client-pbs.relevant-digital.com/openrtb2/auction") { status ->  
        if (status == InitializationStatus.SUCCEEDED) {  
            Log.d(TAG, "SDK initialized successfully!")  
        } else {  
            Log.e(TAG, "SDK initialization error: $status\\  
            ${status.description}")  
        }  
    }
) 

Step 3 - Create BannerAdUnits per placement

For each ad placement (iqadtile), a BannerAdUnit must be created and configured:

  1. Config Id, this is different for each iqadtile and will be provided in a table by iqdigital
  2. The sizes that have been defined for the iqadtile must also be communicated to the BannerAdUnit. (Important: normally more than one size must be passed, they often differ from iqadtile to iqadtile)

Step 4 - Global configurations for BannerAdUnits

These apply equally to all BannerAdUnits

OMID

OMID tells the Headerbidding partners which OpenMeasurement SDK is being used. The GMA SDK has the OpenMeasurementSDK built in, which is why the IDs for Google must be specified here:

iOS:

  • OmidPartnerVersion: afma-sdk-i-v12.11.0
  • OmidPartnerName: Google

Android:

  • OmidPartnerVersion: 253830000.253830000
  • OmidPartnerName: Google

Example:

TargetingParams.setOmidPartnerVersion("253830000.253830000");  
TargetingParams.setOmidPartnerName("Google");

The Headerbidding partners must be informed which APIs are available. In the case of the GMA SDK, the following values are valid:

MRAID 1 to 3, OMID 1

Example:

 
val parameters = BannerParameters()  
parameters.api = listOf(Signals.Api.MRAID_3, Signals.Api.OMID_1,  
Signals.Api.MRAID_2, Signals.Api.MRAID_1)  
adUnit?.bannerParameters = parameters 

Display Manager

The Headerbidding partners should be informed which DisplayManager and which version is being used.

Example:

TargetingParams.setGlobalOrtbConfig(  
    """  
        {  
            "displaymanager": "Google",  
            "displaymanagerver": "${MobileAds.getVersion()}",  
            "ext": {  
                "myext": {  
                    "test": 1  
                }  
            }  
        }  
    """.trimIndent()  
)

Step 5 - iqadtile/page-specific configurations for BannerAdUnits

These differ depending on the iqadtile or page.

GPID

The GPID is there to tell certain Headerbidding partners which placement they are bidding on and is therefore very important. The absence of this information leads to worse bids!

  • gpid corresponds to the AdUnit used for the iqadtile, e.g. /183/FAZ_app_android_phone/homepage
  • pbadslot is a combination of AdUnit and iqadtile, example /183/FAZ_app_android_phone/homepage#iqadtile3
  • relevant_slotInstance is the number of the iqadtile, example 3 for iqadtile3

Example

adUnit?.impOrtbConfig = """  
    {  
        "ext": {  
            "gpid":"/183/FAZ_app_android_phone/homepage"  
            "data": {  
                "pbadslot":"/183/FAZ_app_android_phone/homepage#iqadtile3"  
                "relevant_slotInstance": "3" // optional extra to RY analytics  
            }  
        }  
    }  
""".trimIndent()  

Appendix: How Prebid Mobile SDK and GMA SDK work

  1. The Prebid Mobile SDK sends a request to Prebid Server
  2. Prebid Server returns a bid if available
  3. The ad request to Google Ad Manager is supplemented with the Prebid parameters
  4. Google Ad Manager checks the request and delivers advertising
  5. The app displays the advertising

Important note: An ad request with the GMA SDK always occurs, even if the Prebid Mobile SDK has no bids. Prebid bids supplement the ad request, but they are not a necessary condition.

Important Links

iOS

Android