Prebid.js: priceFloor does not pass bid to bidCpmAdjustment

Type of issue

Object in parameter 2 passed to user-defined bidCpmAdjustment has insuffient parameters

Description

E.G. bid.bidder ist therefore undefined, but should be accessible regarding the doc

image

function getFloor does not pass the bid as third parameter like addBidResponseHook does, so it falls back to {} only holding the cpm.

Steps to reproduce

to trigger getFloor and bidCpmAdjustment you need to configure a custom floor price schema and bidderSettings per bidder. Then just console.log(arguments) in your bidCpmAdjustment function.

Test page

https://www.wieistmeineip.de/

Expected results

get the hole bid data

Actual results

only get property cpm

Platform details

independent

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

I really forgot that when I register a function I will bind the vars from the construction scope o the function and if I do not use it there it will not be accessible, but sure, I can use bidder from the outerscope as I scope it while registering the function.

For the rest, I wasn’t aware, that the floorprice module automatically recalculates the floor needed from the adjusted minimal bid. I testet the example and I saw, that the floorprice module then uses 1.00 and the returned 0.9 to calculate the adjusted floorprice to 1.11 by itself. That’s awesome, I didn’t expect that. I thought I need to do this by myself and therefore differentiate the both calls.

But even then I was missing the bidder in the second argument as stated in the docs and that was the initial intension to this issue. But also here, the calls from the floorprice module seems to be thought as ‘internal calls’ so I understand that this is not documented. And I shouldn’t use enforcement.bidAdjustment if I do not directly use adjusted floorprices per bidder in my floorprice setup.

So, the points presented by dgirardi are surely the right things to do

I think the actions here are:

  • update the floors module to warn when schema fails validation (or is missing)
  • update the documentation to make it clear that the second arg is not always complete
  • we can fill that argument a bit more when it’s called without a bid. bidderCode for example is known even without it.

Thank you very much for clearing my up!

on the last action item - we agreed to update the bidCpmAdjustment API to take in cpm, bidResponse, bidRequest (instead of trying to craft a partial bidResponse when we don’t have it).