Skip to content
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

Merged
merged 2 commits into from
Apr 3, 2018

Conversation

jsnellbaker
Copy link
Collaborator

@jsnellbaker jsnellbaker commented Apr 2, 2018

Type of change

  • Bugfix

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 the adaptermanager.js over to the prebidServerBidAdapter.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 the adUnits. 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 the adUnits unmodified object.

The fix for this issue is to introduce a filter that removes any bidders from the adUnits object if there is no corresponding bid in the bidder's client-side request for that adUnit. It performs a two stage check, first against the adUnit.code with the request.bid.adUnitCode (in case the same bidder is in multiple adUnits) and second against the adUnit.bid.bidder with the request.bidderCode.

Other information

Fixes issue #2315

@@ -113,7 +113,7 @@ function getAdUnitCopyForPrebidServer(adUnits) {
let adUnitsCopy = utils.deepClone(adUnits);

adUnitsCopy.forEach((adUnit) => {
adUnit.sizes = transformHeightWidth(adUnit);
adUnit.sizesS2S = transformHeightWidth(adUnit);
Copy link
Member

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?

Copy link
Collaborator Author

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.

@mkendall07 mkendall07 self-assigned this Apr 2, 2018
@mkendall07
Copy link
Member

This should be good once the change is made

@mkendall07 mkendall07 added the LGTM label Apr 3, 2018
@jsnellbaker
Copy link
Collaborator Author

@mkendall07 I just pushed in the changes.

@mkendall07 mkendall07 merged commit 749e3c4 into master Apr 3, 2018
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
…id#2332)

* initial commit to fix issue prebid#2315

* moved transformHeightWidth function to prebidServerBidAdapter
@mkendall07 mkendall07 deleted the bugfix/issue-2315 branch August 17, 2018 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants