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

relevantDigital.getBidderHandler()

Map a Prebid bid to its Relevant Yield SSP handler and identifier.

Use relevantDigital.getBidderHandler(bid) to retrieve the Relevant Yield handler for a bid's bidder.

The handler includes the SSP ID used in Relevant Yield.

Use per-SSP settings

Use this function with placement tag fields, Prebid configuration fields, or site tag fields. These settings can store values per SSP through ByObject fields or multi-select String fields.

Map each bid to its SSP ID before retrieving values from placement data, such as adUnit.data.

Return value

id

The Relevant Yield SSP ID for the bid's bidder.

Example

This example applies a per-SSP CPM Multiplier from placement tag fields.

Use bidCpmAdjustment to adjust the bid. Use relevantDigital.getAdUnitInstanceByBid() to find the matching placement. Then use relevantDigital.getBidderHandler() to retrieve its SSP settings.

window.relevantDigital = window.relevantDigital || {};
relevantDigital.cmd = relevantDigital.cmd || [];
relevantDigital.cmd.push(() => {

    // Get the 'pbjs' object like this to support changing
    // pbjs-variable name
    const { pbjs } = relevantDigital.getInstance();
    
    pbjs.bidderSettings = pbjs.bidderSettings || {};
    pbjs.bidderSettings.standard = pbjs.bidderSettings.standard||{};
    
    // Add bid cpm adjustment function for all bidders
    pbjs.bidderSettings.standard.bidCpmAdjustment = (cpm, bid) => {
    
        // Get the AdUnitInstance object for the bid
        const adUnitInstance =
            relevantDigital.getAdUnitInstanceByBid(bid);
        
        // Grab 'customSettingsBySsp' from the AdUnit associated
        // with the AdUnitInstance.
        const { customSettingsBySsp } = adUnitInstance.adUnit.data
        
        // Use getBidderHandler() to get the SSP id in Yield
        const sspId = relevantDigital.getBidderHandler(bid).id;

        const customSettings = customSettingsBySsp[sspId];
        return cpm * customSettings.cpmMultiplier;
    };
});

Last updated

Was this helpful?