Back to Bidding-Only Integration
To integrate Video Interstitial ads into the app you should use the Prebid SDK VideoInterstitialAdUnit
class. It makes bid requests to Prebid Server and provides targeting keywords of the winning bid to the GMA SDK.
Integration Example:
func createAd() {
// 1. Create a VideoInterstitialAdUnit using Prebid Mobile SDK
adUnit = VideoInterstitialAdUnit(configId: CONFIG_ID)
// 2. Configure video parameters using Prebid Mobile SDK
let parameters = VideoParameters()
parameters.mimes = ["video/mp4"]
parameters.protocols = [Signals.Protocols.VAST_2_0]
parameters.playbackMethod = [Signals.PlaybackMethod.AutoPlaySoundOn]
adUnit.parameters = parameters
// 3. Make a bid request to Prebid Server using Prebid Mobile SDK
let gamRequest = GAMRequest()
adUnit.fetchDemand(adObject: gamRequest) { [weak self] resultCode in
DemoLogger.shared.info("Prebid demand fetch for GAM \(resultCode.name())")
// 4. Load a GAM interstitial ad using Google Mobile Ads SDK
GAMInterstitialAd.load(withAdManagerAdUnitID: AD_UNIT_ID, request: gamRequest) { ad, error in
guard let self = self else { return }
if let error = error {
DemoLogger.shared.error("Failed to load interstitial ad with error: \(error.localizedDescription)")
} else if let ad = ad {
// 5. Immediately render the interstitial ad
ad.present(fromRootViewController: self)
ad.fullScreenContentDelegate = self
}
}
}
}
Initialize the VideoInterstitialAdUnit
with properties:
configId
- an ID of the Ad Unit Level Stored Request on Prebid ServerUsing the VideoParameters
object you can customize the bid request for video ads.
Not needed for Instream video integration, which uses placement=1 and plcmt=1.
The OpenRTB 2.6 Placement Type for the auction can be expressed as an integer array or you can use an enum for easier readability.
2
or InBanner
: In-Banner placement exists within a web banner that leverages the banner space to deliver a video experience as opposed to another static or rich media format. The format relies on the existence of display ad inventory on the page for its delivery.3
or InArticle
: In-Article placement loads and plays dynamically between paragraphs of editorial content; existing as a standalone branded message.4
or InFeed
: In-Feed placement is found in content, social, or product feeds.5
or Slider
, Floating
or Interstitial
: Open RTB supports one of three values for option 5 as either Slider, Floating or Interstitial. If an enum value is supplied in placement, bidders will receive value 5 for placement type and assume to be interstitial with the instl flag set to 1.Notes:
The api
property is dedicated to adding values for API Frameworks to bid response according to the OpenRTB 2.6 spec. The supported values for GMA SDK integration are:
1
or Signals.Api.VPAID_1
: VPAID 1.02
or Signals.Api.VPAID_2
: VPAID 2.03
or Signals.Api.MRAID_1
: MRAID-1 support signal5
or Signals.Api.MRAID_2
: MRAID-2 support signal6
or Signals.Api.MRAID_3
: MRAID-3 support signal7
or Signals.Api.OMID_1
: signals OMSDK supportInteger representing the OpenRTB 2.6 maximum bit rate in Kbps.
Integer representing the OpenRTB 2.6 minimum bit rate in Kbps.
Integer representing the OpenRTB 2.6 maximum video ad duration in seconds.
Integer representing the OpenRTB 2.6 minimum video ad duration in seconds.
Array of strings representing the supported OpenRTB 2.6 content MIME types (e.g., “video/x-ms-wmv”, “video/mp4”). Required property.
Array of OpenRTB 2.6 playback methods. If none are specified, any method may be used. Only one method is typically used in practice. It is strongly advised to use only the first element of the array.
1
or Signals.PlaybackMethod.AutoPlaySoundOn
: Initiates on Page Load with Sound On2
or Signals.PlaybackMethod.AutoPlaySoundOff
: Initiates on Page Load with Sound Off by Default3
or Signals.PlaybackMethod.ClickToPlay
: Initiates on Click with Sound On4
or Signals.PlaybackMethod.MouseOver
: Initiates on Mouse-Over with Sound On5
or Signals.PlaybackMethod.EnterSoundOn
: Initiates on Entering Viewport with Sound On6
or Signals.PlaybackMethod.EnterSoundOff
: Initiates on Entering Viewport with Sound Off by DefaultArray or enum of OpenRTB 2.6 supported Protocols. Values can be one of:
1
or Signals.Protocols.VAST_1_0
: VAST 1.02
or Signals.Protocols.VAST_2_0
: VAST 2.03
or Signals.Protocols.VAST_3_0
: VAST 3.04
or Signals.Protocols.VAST_1_0_Wrapper
: VAST 1.0 Wrapper5
or Signals.Protocols.VAST_2_0_Wrapper
: VAST 2.0 Wrapper6
or Signals.Protocols.VAST_3_0_Wrapper
: VAST 3.0 Wrapper7
or Signals.Protocols.VAST_4_0
: VAST 4.08
or Signals.Protocols.VAST_4_0_Wrapper
: VAST 4.0 WrapperThe fetchDemand method makes a bid request to the Prebid Server. The GAMRequest
object provided to this method must be the one used in the next step to make the GAM ad request.
When Prebid Server responds, Prebid SDK will set the targeting keywords of the winning bid into provided object.
After receiving a bid it’s time to load the ad from GAM. If the GAMRequest
contains targeting keywords, the respective Prebid line item may be returned from GAM, and GMA SDK will render its creative.
Follow the GMA SDK guide to display the interstitial ad. Note that you’ll need to decide whether it’s going to be rendered immediately after receiving it or rendered later in the flow of an app. Note that the example above implements an immediate render approach.