Prebid Mobile SDK in Apps: Difference between revisions
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 | 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: | |||
*General overview: https://docs.prebid.org/prebid-mobile/prebid-mobile.html | |||
*iOS: https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html | |||
*Android: https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html | |||
==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 | |||
*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. | |||
=== | ====Example:==== | ||
<pre> | |||
TargetingParams.setGlobalOrtbConfig( | |||
""" | |||
{ | |||
"displaymanager": "Google", | |||
"displaymanagerver": "${MobileAds.getVersion()}", | |||
"ext": { | |||
"myext": { | |||
"test": 1 | |||
} | |||
} | |||
} | |||
""".trimIndent() | |||
) | |||
</pre> | |||
==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==== | ||
<pre> | <pre> | ||
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() | |||
</pre> | </pre> | ||
== | ==Appendix: How Prebid Mobile SDK and GMA SDK work== | ||
[[Datei:Prebid SDK.png|800px]] | |||
#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-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] | ||
===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] | ||
[[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:
- General overview: https://docs.prebid.org/prebid-mobile/prebid-mobile.html
- iOS: https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html
- Android: https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html
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
- Prebid Server Account Id: <<<PREBID_SERVER_ACCOUNT_ID>>>
- Prebid Server Url: https://client-pbs.relevant-digital.com/openrtb2/auction
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:
- 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:
TargetingParams.setOmidPartnerVersion("253830000.253830000");
TargetingParams.setOmidPartnerName("Google");
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:
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
- 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.