Set up Google OOP format
Configure Google Ad Manager out-of-page slots through HB Manager auction callbacks.
Use this pattern to define selected Google Ad Manager placements as out-of-page slots.
The callback replaces googletag.defineSlot() with googletag.defineOutOfPageSlot() for matching slots.
Before you start
Add an identifying attribute to each slot that should use an out-of-page format. This example uses data-dfp-oop.
The implementation overrides the Google slot definition during onBeforeAuctionSetup.
Implementation
Register the callback before loading ads:
relevantDigital.addAuctionCallbacks({
onBeforeAuctionSetup: ({ auction }) => {
auction.googletagCalls = auction.googletagCalls || {};
auction.googletagCalls.defineSlot = (adUnitPath, size, div) => {
const element = document.getElementById(div);
const format = element?.getAttribute('data-dfp-oop');
if (format === 'outOfPage' || format === 'homepageOutOfPage') {
return googletag.defineOutOfPageSlot(adUnitPath, div);
}
return googletag.defineSlot(adUnitPath, size, div);
};
},
});How it works
onBeforeAuctionSetupruns before the auction starts.The callback overrides the auction’s
defineSlotfunction.The override reads
data-dfp-oopfrom the slot element.Matching values create an out-of-page slot. All other slots use the standard definition.
Related API references
relevantDigital.addAuctionCallbacks() — Register auction lifecycle callbacks.
relevantDigital.loadPrebid() — Load and configure HB Manager auctions.
Last updated
Was this helpful?