-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue #2315 sizeMapping not working with s2s requests #2332
Conversation
src/adaptermanager.js
Outdated
@@ -113,7 +113,7 @@ function getAdUnitCopyForPrebidServer(adUnits) { | |||
let adUnitsCopy = utils.deepClone(adUnits); | |||
|
|||
adUnitsCopy.forEach((adUnit) => { | |||
adUnit.sizes = transformHeightWidth(adUnit); | |||
adUnit.sizesS2S = transformHeightWidth(adUnit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just move this function into prebidServerBidAdapter instead of adding a temporary sizesS2S?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - I'll move the function over and make other adjustments.
This should be good once the change is made |
@mkendall07 I just pushed in the changes. |
…id#2332) * initial commit to fix issue prebid#2315 * moved transformHeightWidth function to prebidServerBidAdapter
Type of change
Description of change
This PR addresses the issue reported in #2315 and a subsequent issue found during testing.
The issue with the sizeMapping functionality was due to the
adUnit.sizes
being transformed from a list of integer sizes (ie[[300, 250], [300, 600]]
to a list of objects (ie[{w: 300, h: 250}, {w: 300, h: 600}]
). The sizeMapping code expected a list of integer sizes, not the object format sizes - so it never passed the filtering check properly.The fix places moves the
transformHeightWidth
function from theadaptermanager.js
over to theprebidServerBidAdapter.js
file, so that the size values are transformed when pbs needs them.During testing for this fix, a subsequent issue was observed and fixed. In this issue, a bidder that was rejected by the sizeMapping still had the opportunity to participate in the pbs auction and could win the bid. This is due to the fact that the sizeMapping functionality filters out the invalid
adUnit
bidders and simply doesn't include them in the bids objects that are made in the request object. The sizeMapping functionality doesn't directly edit/remove the invalid bidders from theadUnits
. This indirectly causes the issue, since the the actual request object made for the pbs request is built separately from the client-side request and it uses theadUnits
unmodified object.The fix for this issue is to introduce a filter that removes any bidders from the
adUnits
object if there is no correspondingbid
in the bidder's client-side request for thatadUnit
. It performs a two stage check, first against theadUnit.code
with therequest.bid.adUnitCode
(in case the same bidder is in multiple adUnits) and second against theadUnit.bid.bidder
with therequest.bidderCode
.Other information
Fixes issue #2315