Prebid Mobile SDK in Apps: Difference between revisions

From Documentation
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Introduction==
==Introduction==
The Prebid Mobile SDK serves to integrate different header bidding providers in one app, and these providers can then make initial bids for the available ad positions on a page when the page is called. The winning bid is then forwarded via the Google Mobile Ads SDK to the ad server, which compares the bid with other bookings that are present there and serves the most suitable booking.
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.


==Integration and mode of operation==
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.
[[Datei:Prebid SDK.png|800px]]
Basic documentation of Prebid Mobile can be found here:
#Integrate the Prebid Mobile SDK
*General overview: https://docs.prebid.org/prebid-mobile/prebid-mobile.html
::iOS: https://github.com/prebid/prebid-mobile-ios
*iOS: https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html
::Android: https://github.com/prebid/prebid-mobile-android
*Android: https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html
#Create the banner ad unit with all sizes and additional sizes that are to be included in the prebid request (the PREBID_SERVER_CONFIGURATION_ID is taken from a separate table and assigned to the corresponding position (Note for Ad Technology iq digital: The PREBID_SERVER_CONFIGURATION_ID of a placement is the "Targeting ID" in Prebid Server Premioum by Xandr)).
 
#The Prebid Mobile SDK sends a request to the prebid server.
==Step 1 - Integrate Prebid Mobile SDK==
#The prebid server sends back an offer (if present).
*iOS: https://github.com/prebid/prebid-mobile-ios
#The ad request to Google Ad Manager is supplemented by the prebid parameters.
*Android: https://github.com/prebid/prebid-mobile-android
#Google Ad Manager reviews the request and serves the ad.
 
#The app displays the ad.
==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
 
*Prebid Server Account Id: '''<<<PREBID_SERVER_ACCOUNT_ID>>>'''
*Prebid Server Url: '''https://client-pbs.relevant-digital.com/openrtb2/auction'''
 
===Example===
<pre>
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}") 
        } 
    }
)
</pre>
 
==Step 3 - Create BannerAdUnits per placement==
For each ad placement (iqadtile), a BannerAdUnit must be created and configured:
 
#'''Config Id''', this is different for each iqadtile and will be provided in a table by iqdigital
#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:====
<pre>
TargetingParams.setOmidPartnerVersion("253830000.253830000")
TargetingParams.setOmidPartnerName("Google");
</pre>
 
===Banner API===
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:====
<pre>
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
</pre>


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


===Android example===
====Example:====
The example on the page shows that man wohl einen DFP PublisherAdView (??) and then generates the prebid banner ad unit. This is then given the prebid server request ID assigned to the banner ad unit and defines a size. Additional sizes are transmitted to the object using the add additional size method. Here, all the sizes should be transmitted that are also normally part of the ad request for the position.
<pre>
TargetingParams.setGlobalOrtbConfig( 
    """ 
        { 
            "displaymanager": "Google", 
            "displaymanagerver": "${MobileAds.getVersion()}",
            "ext": { 
                "myext": { 
                    "test": 1 
                } 
            } 
        } 
    """.trimIndent() 
)
</pre>


The bids are then connected using fetchDemand. The result codes are defined here: http://prebid.org/prebid-mobile/pbm- api/android/pbm-api-result-codes-android.html
==Step 5 - iqadtile/page-specific configurations for BannerAdUnits==
In general, however, an ad request should always occur, regardless of whether bids are contained or not.
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!


==Important configurations==
*'''gpid''' corresponds to the AdUnit used for the iqadtile, e.g. /183/FAZ_app_android_phone/homepage
In our case, the Prebid Mobile SDK works together with Prebid Server Premium and therefore needs a few adjustments:
*'''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


===Set Host===
====Example====
Prebid Server Premium must be configured as a custom host. This is done in Android like this:
<pre>
<pre>
Host custom = Host.CUSTOM;
adUnit?.impOrtbConfig = """ 
custom.setHostUrl("https://ib.adnxs.com/openrtb2/prebid");
    { 
PrebidMobile.setPrebidServerHost(custom);
        "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()
</pre>
</pre>
[https://docs.prebid.org/prebid-mobile/pbm-api/android/prebidmobile-object-android.html#sethost Anleitung Android Custom Host]<br />
[https://docs.prebid.org/prebid-mobile/pbm-api/ios/prebidmobile-object-ios.html Anleitung iOS Custom Host]


===Set Account ID===
==Appendix: How Prebid Mobile SDK and GMA SDK work==
Our account ID must also be set.
[[Datei:Prebid SDK.png|800px]]
<pre>PrebidMobile.setPrebidServerAccountId("6975");</pre>
#The Prebid Mobile SDK sends a request to Prebid Server
#Prebid Server returns a bid if available
#The ad request to Google Ad Manager is supplemented with the Prebid parameters
#Google Ad Manager checks the request and delivers advertising
#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==
==Important Links==
*[https://docs.prebid.org/prebid-mobile/prebid-mobile.html Getting Started]
*[https://docs.prebid.org/prebid-mobile/prebid-mobile.html Getting Started]
*[https://docs.prebid.org/prebid-mobile/prebid-mobile-pbs.html#developers---using-the-sdk Developers using the SDK]
*[https://docs.prebid.org/prebid-mobile/privacy-regulation.html Privacy Regulation]
*[https://docs.prebid.org/prebid-server/use-cases/pbs-sdk.html#prebid-sdk-calls-prebid-server Prebid SDK Workflow]
*[https://docs.prebid.org/prebid-server/use-cases/pbs-sdk.html#prebid-sdk-calls-prebid-server Prebid SDK Workflow]


===iOS===
===iOS===
*[https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html Code Integration]
*[https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html Code Integration]
*[https://docs.prebid.org/prebid-mobile/pbm-api/ios/pbm-banneradunit-ios.html Banner Adunit]


===Android===
===Android===
*[https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html Code Integration]
*[https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html Code Integration]
*[https://docs.prebid.org/prebid-mobile/pbm-api/android/pbm-banneradunit-android.html Banner Adunit]
[[de:Prebid Mobile SDK in Apps]]
[[de:Prebid Mobile SDK in Apps]]

Latest revision as of 11:33, 30 January 2026

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

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