Ads & monetisation

Header bidding

Run a Prebid.js auction before the ad, with a plain adTagUrl as the fail-open fallback.

headerBidding runs a Prebid auction before the ad and falls back to the plain tag on no-fill. It never blocks mounting, playback or controls - only the first ad request waits on it, bounded by timeoutMs, so a viewer who presses play immediately still gets the winning bid rather than the fallback tag. Every failure mode (no window.pbjs, timeout, no bid, buildVideoUrl() throwing) fails open:

<VideoCard
  src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
  ad-tag-url="https://pubads.g.doubleclick.net/gampad/ads?..."
  :header-bidding="{
    adUnit: {
      code: 'video-instream-demo',
      mediaTypes: {
        video: {
          context: 'instream',
          playerSize: [640, 480],
          mimes: ['video/mp4'],
          protocols: [1, 2, 3, 4, 5, 6, 7, 8],
          playbackmethod: [2],
          skip: 1,
        },
      },
      bids: [{ bidder: 'appnexus', params: { placementId: 13232361 } }],
    },
    params: { iu: '/21775744923/external/single_ad_samples' },
    timeoutMs: 2000,
  }"
/>
KeyPurpose
adUnitA standard Prebid video ad unit - the same object you'd pass to pbjs.addAdUnits()
paramsPassed through to buildVideoUrl() (GAM ad tag params)
timeoutMsBounds the auction, and this step's fail-open timeout. Defaults to 1000
Always keep a plain adTagUrl as the fallback - never rely on headerBidding alone.

Verify a bid actually arrived with pbjs.getBidResponsesForAdUnitCode('your-ad-unit-code').

munsonlabs · MIT licensed · © 2026