Prebid Integration
Integrates Yaleo placements into Prebid.js using the yaleo bidder adapter from the official Prebid.js repository (v10+).
See Yaleo Bid Adapter for bidder params and integration details.
Server
Section titled “Server”js/apps/yaleo-bidder/server is an Express server that handles OpenRTB requests from Prebid.js. It fetches placement configuration and ads from Xandr, then serializes the result as pre-rendered HTML returned as a Prebid bid.
Client
Section titled “Client”js/apps/yaleo-bidder/client is injected into the pre-rendered HTML and hydrates the placement once it is rendered in the publisher page. It handles dynamic behavior: dispatching analytics events, adjusting the host iframe size, and applying parent page media queries to the iframe.
Slot Resizing in a SafeFrame
Section titled “Slot Resizing in a SafeFrame”When the placement grows taller than its slot and a cross-origin frame (a GAM SafeFrame) keeps the client from resizing the slot frame itself, the client asks the page’s Prebid.js to do it with Prebid’s resizeNativeHeight message (message: 'Prebid Native'). The slot keeps its width; fluid (1x1) bids take the full slot width.
This needs:
- a GAM creative that declares
ucTagDataas a global, as the stock Prebid Universal Creative template does, because it carries the bid’sadId; - a Prebid.js build with the
NATIVEfeature. A build without it ignores the message, and the placement stays at the slot size.
Prebid finds the bid by its adId. A page that sets Prebid’s minBidCacheTTL drops bids once their TTL has passed, so a placement that grows after that keeps its last size.
Without a global ucTagData, as with htag’s Universal Creative template, the client grows the slot with a SafeFrame $sf.ext.expand overlay.
Dark Theme
Section titled “Dark Theme”Dark theme can be forced when the server renders the placement HTML:
- Per ad unit — set
forceDarkTheme: truein theyaleobidder params. - Request-wide — set
device.ext.darkmode: 1on the OpenRTB request (via Prebidortb2). The server maps this to dark theme for every placement that does not setforceDarkTheme.
Per-ad-unit forceDarkTheme takes precedence over device.ext.darkmode.
When neither is set, the hydrated client may still enable dark theme via publisher-specific detectors, and via prefers-color-scheme on known dark-theme sites.
See Yaleo Bid Adapter → Dark Theme for configuration examples.
Legacy
Section titled “Legacy”A Prebid.js adapter that runs all placement and ad fetching logic client-side, with rendering provided by https://cdn.adnz.co/yaleo/prebid.js (part of js/apps/yaleo).
See Yaleo Legacy Bid Adapter for params.
See Migration from Legacy Adapter for migration steps.
Reasons for Creating a New Adapter
Section titled “Reasons for Creating a New Adapter”- Multi-ad placements were not supported. Prebid.js does not allow sequential requests within a single auction. For multi-ad placements, the placement configuration (which includes the number of ads) must be fetched first, followed by a separate ad request — a flow the legacy adapter could not support.
- Could not be published in the official Prebid.js repository. The adapter explicitly loaded an external JS script, which violates Prebid.js required adapter rules.
- Required redundant parameters. Publishers had to specify the Xandr tag ID explicitly, even though it is already part of the Yaleo placement configuration.