Add mobile web interstitial GPT example#6609
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 354e475ab1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pbjs.que.push(function() { | ||
| pbjs.setTargetingForGPTAsync([INTERSTITIAL_AD_UNIT]); | ||
| googletag.pubads().refresh([interstitialSlot]); |
There was a problem hiding this comment.
Avoid queuing the timeout refresh behind Prebid
In contexts where Prebid.js is slow or blocked, the failsafe timeout can enter this path, but the GAM refresh is still queued on pbjs.que; if the Prebid library never loads, this function never runs, and because disableInitialLoad() was enabled the interstitial slot never makes an ad server request. The standard GPT examples in this repo handle this by checking pbjs.libLoaded and refreshing GPT directly when Prebid is unavailable, so this sample should include the same fallback for timeout-only paths.
Useful? React with 👍 / 👎.
✅ Deploy Preview for prebid-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
### Motivation - Provide a concrete example for pairing a Prebid.js interstitial ad unit with a Google Publisher Tag (GPT) out-of-page interstitial to address Prebid.js issue #5917. - Clarify the expected flow and signals (including `ortb2Imp.instl`) for bidders and publishers using web interstitials. ### Description - Added a new "Mobile Web Interstitial with GPT" section to `features/InterstitialAds.md` containing a complete code example that shows a Prebid ad unit, `pbjs.requestBids`, `pbjs.setTargetingForGPTAsync`, and `googletag.defineOutOfPageSlot` usage. - Introduced a simple guard (`pbjs.interstitialAdServerRequestSent`) in the example to avoid sending duplicate ad server refreshes if the slot is not ready. - Documented implementation notes covering that `defineOutOfPageSlot()` may return `null`, the use of `googletag.pubads().disableInitialLoad()`, and that `googletag.display()` registers the GPT interstitial slot which only appears when GPT receives a fill and an eligible trigger occurs. ### Testing - Ran `npx markdownlint-cli --config .markdownlint.json features/InterstitialAds.md` against the edited Markdown file and observed no lint failures. - Ran `bundle exec jekyll build` to verify the site generates and the build completed successfully.
| code: INTERSTITIAL_AD_UNIT, | ||
| mediaTypes: { | ||
| banner: { | ||
| sizes: [[320, 480], [480, 320]] |
There was a problem hiding this comment.
Just noting that if you go the defineOutOfPageSlot route in GPT, that also doesn't take sizes https://developers.google.com/publisher-tag/reference#googletag.defineOutOfPageSlot
There was a problem hiding this comment.
Right but this size is for prebid?
I did another commit with the deferred billing setup, which was our main blocker going line with this in the past for all bidders
There was a problem hiding this comment.
Yep I'm just not totally clear on if defineOutOfPageSlot not taking sizes will mean that we can't actually specify sizes in the GAM request. Like, if we request a 320x480 from the bidder, but there's no size restriction/qualifier on the line item, then should we specify sizes on the prebid side? I might have some of the mechanics wrong here though
### Motivation - Provide a concrete example and guidance for using Prebid.js with Google Publisher Tag (GPT) web interstitials on mobile, clarifying how the Prebid ad unit `code` maps to the GPT slot and how to signal interstitial demand with `ortb2Imp.instl`. - Explain practical considerations for GPT out-of-page slots such as `defineOutOfPageSlot()` possibly returning `null`, coordinating Prebid targeting with GPT, and handling fallback timing. ### Description - Add a new "Mobile Web Interstitial with GPT" section to `features/InterstitialAds.md` that includes a complete sample integration demonstrating `ortb2Imp.instl: 1`, ad unit configuration, `pbjs.requestBids()` usage, and a `sendInterstitialAdServerRequest()` flow. - Show how to define an out-of-page GPT slot with `googletag.defineOutOfPageSlot(..., googletag.enums.OutOfPageFormat.INTERSTITIAL)`, check for a `null` return, call `googletag.display()` to register the interstitial, and coordinate `pbjs.setTargetingForGPTAsync()` with `googletag.pubads().refresh()`. - Document the use of `disableInitialLoad()` to prevent GPT from requesting the interstitial before Prebid targeting is set and the timeout-based fallback that refreshes GPT when Prebid times out. ### Testing - No automated tests were run because this is a documentation-only change.
|
|
||
| pbjs.interstitialAdServerRequestSent = true; | ||
| googletag.cmd.push(function() { | ||
| if (pbjs.libLoaded) { |
There was a problem hiding this comment.
this is a performance thing, right? Instead of pushing to the prebid que, this short circuits it
| googletag.cmd.push(function() { | ||
| interstitialSlot = googletag.defineOutOfPageSlot( | ||
| INTERSTITIAL_AD_UNIT, | ||
| googletag.enums.OutOfPageFormat.INTERSTITIAL |
There was a problem hiding this comment.
I didn't get this working with Prebid bids.
What line item setup is required to make this work? A minimal ad ops section would make this a full example.
fixes prebid/Prebid.js#5917