For the complete documentation index, see llms.txt. This page is also available as Markdown.

relevantDigital.getAdUnitInstanceByBid()

Retrieve a Relevant Yield placement and ad slot from a Prebid bid object.

Use relevantDigital.getAdUnitInstanceByBid() to match a Prebid bid object to its Relevant Yield placement and ad slot.

Pass a bid from pbjs.onEvent() or another Prebid API method.

Return value

Returns an object with a slot property for the matching ad slot.

For Google Ad Manager, slot may be a googletag.Slot. For instream video, delayedAdserverLoading, or other ad servers, it is a Relevant Yield object with a smaller API.

slot.getSlotElementId()

Returns the ad slot's div ID. For instream video, it returns the ID supplied to relevantDigital.defineVideoSlots().

slot.getAdUnitPath()

Returns the ad unit path or placement ID.

Parameters

bid

The bid object returned by Prebid. For example, use a bid from pbjs.onEvent() or pbjs.getBidResponses().

Example

pbjs.onEvent('bidWon', (bid) => {
    const instance = relevantDigital.getAdUnitInstanceByBid(bid);
    const { slot } = instance;
    console.info('div id: ', slot.getSlotElementId());
    console.info('placement id: ', slot.getAdUnitPath());
});

Last updated

Was this helpful?