Skip to content

reduceBidRequest

The reduceBidRequest hook allows you to modify or filter bid requests before they are sent to bidders through Prebid.js. This is useful for customizing bid parameters, adding targeting data, or conditionally skipping certain bid requests.

window.htag = window.htag || {};
window.htag.reduceBidRequest = function (bidRequest, config) {
// Add custom targeting parameters
bidRequest.params = {
...bidRequest.params,
customParam: 'value',
siteId: getSiteId(),
};
// Skip bid request for mobile devices on specific placements
if (isMobile() && config.elementId === 'sidebar-ad') {
return null;
}
return bidRequest;
};
  • bidRequest (object): The original bid request object that will be sent to the bidder
    • Contains bidder-specific parameters and targeting information
    • Structure varies by bidder but follows Prebid.js conventions
  • config (object): The placement configuration for the current bid
    • elementId (string): The ID of the placement element
    • mediaTypes (array): Supported media types for this placement
    • bids (array): All bid configurations for this placement
    • Additional placement configuration properties
  • object: The modified bid request object
  • null or undefined: Skip this bid request entirely