This how-to guide covers the original approach for integrating the Prebid SDK into your app with the GMA SDK. It utilizes:
If you do not have GMA SDK in the app, refer to the Google Integration Documentation.
Another way to integrate GAM into your app is with the Prebid-Rendered Integration.
Tradeoffs between these integration approaches:
Aspect | Bidding-Only Integration | Prebid-Rendered Integration |
---|---|---|
App code has direct access to bids | ||
Support for MRAID 3.0 | ||
Support for SKAdnetwork | ||
Loads data from Prebid Cache | ||
Supports instream video | ||
Triggers billing and Notice URLs | ||
Supports Third Party Rendering libraries |
Notes:
The GAM Bidding-Only Integration method assumes that you have the following components:
Here’s how the ad bidding-auction-rendering process works in this integration scenario.
Assuming your app already has AdUnits integrated with the GMA SDK, the technical implementation of Prebid mobile into your app will involve these major steps:
The Ad Operations team will need to create line items in GAM. The creatives used depend on which media formats your adunits utilize.
AdUnit Format | Line Item Targeting | Creative Type | Prebid Cache? | Ad Ops Details |
---|---|---|---|---|
HTML banner, interstitial banner | hb_pb hb_format=banner |
3rd party HTML that loads the PUC | yes | link |
Video (instream, non-instream, interstitial) | hb_pb hb_format=video inventoryType in (instream, mobile app) |
VastUrl pointing to Prebid Cache | yes | link |
Rewarded Video | hb_pb hb_format=video inventoryType in (instream, mobile app) rewarded adunits |
VastUrl pointing to Prebid Cache | yes | link |
In-app native | hb_pb hb_format=native |
GAM native | no | link |
In-Webview native | hb_pb hb_format=native |
3rd party HTML that loads the native-trk script. | yes | link |
Notes:
This information may be useful when comparing data across various reporting systems:
Scenario | PUC | VastUrl Creative | GAM Native Creative |
---|---|---|---|
Rendering Method | PUC in iframe | GMA SDK player | App code with data from PBSDK |
Fires Prebid win event | always | never | always |
Fires Prebid imp event | never | VAST impression tag | never |
Fires OpenRTB burl | when in view | n/a | never (1) |
Fires OpenRTB nurl | always | n/a | always |
Fires OpenMeasurement events | GMA SDK | n/a | PB SDK |
Notes:
This section describes the integration details for different ad formats. In each scenario, you’ll be asked for a configId
- this is a key established in conjunction with your Prebid Server provider. It’s used at runtime to pull in the bidders and parameters specific to this adunit. Depending on your Prebid Server partner, it may be a UUID or constructed out of parts like an account number and adunit name.
Each ad unit in the original integration method is a subclass of the AdUnit
class, which provides the following properties and methods for the additional configuration.
(requires SDK v2.3.1)
Prebid SDK allows the customization of the OpenRTB request on the ad unit level using the setImpORTBConfig()
function:
adUnit.setImpORTBConfig("{\"bidfloor\":0.01,\"banner\":{\"battr\":[1,2,3,4]}}")
The parameter passed to setImpORTBConfig()
will be merged into the respective imp
object for this Ad Unit. For instance, the above example will add the $.imp[0].bidfloor
and $.imp[0].banner.battr
parameters to the bid request.
To empty out a previously provided impression config, just set it to the empty string:
adUnit.setImpORTBConfig("")
If set on a given banner ad unit, the fetchDemand
function will be called every periodMillis
until stopAutoRefresh
is called. Each call to fetchDemand
will invoke the onComplete
function. This refresh only pertains to Prebid Mobile and not to any ad server refresh processes. It is suggested that the adServes refresh be turned off.
Halts the auto-refresh behavior for a given Prebid Mobile ad unit. If no auto-refresh behavior has been set, stopAutoRefresh
will be ignored.
Resumes a stopped autorefresh for the ad unit with the previously-defined autorefresh value.
(requires SDK v2.1.6)
The Global Placement ID (GPID) is a key that uniquely identifies a specific instance of an adunit. Some bidders require this value. An important scenario is “infinite scroll” – if your app creates instances of an adunit dynamically as the user scrolls through content, the the GPID must be different for each by appending some kind of sequence or ID. e.g. “/newsfeed#7”
Using the following method, you can set the impression-level GPID value to the bid request:
adUnit.setGPID("/36117602/hnp-sfgate.com/Homepage/AP300")
The adPosition
property allows developers to specify the position of the ad within the publisher’s content. This property maps to the pos
field in the OpenRTB specification under the imp[].banner
or imp[].video
objects, depending on the ad format. The possible values for this field could be found in the respective specification.
You can set adPosition
by using the following property:
adUnit.adPosition = .footer