getBidderHandler(bid) returns a "handler" for a bid's bidder. Most importantly, the handler contains the id of the SSP in Relevant Yield.
This function is normally used in conjunction with Placement/Prebid Config/Site tag fields where per-SSP settings has been created (ByObject type settings with object type SSP or multi-select String fields with options type SSP). In these cases it's often necessary to map specific bids to the SSP ids referenced in the data objects (adUnit.data, etc).
Example
In this example we have created a "CPM Multiplier" setting per SSP that can be controlled per placement by adding settings in Placement tag fields like this:
We can then use this setting in a bidCpmAdjustment function, like below. In order to find the settings for the right placement we're using getAdUnitInstanceByBid. To then get the right settings per SSP we're using getBidderHandler to map the bid to a SSP's id in Yield.
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;
};
});