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

IX Bid Adapter: send bid floor per size in format ext #9084

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,10 +762,15 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
},
};

// We add sid in imp.ext.sid therefore, remove from banner.format[].ext
for (let bannerFormat of _bannerImpression.banner.format) {
if (bannerFormat.ext != null && bannerFormat.ext.sid != null) {
delete bannerFormat.ext.sid;
for (let i = 0; i < _bannerImpression.banner.format.length; i++) {
// We add sid in imp.ext.sid therefore, remove from banner.format[].ext
if (_bannerImpression.banner.format[i].ext != null && _bannerImpression.banner.format[i].ext.sid != null) {
delete _bannerImpression.banner.format[i].ext.sid;
}

// add floor per size
if ('bidfloor' in impressionObjects[i]) {
_bannerImpression.banner.format[i].ext.bidfloor = impressionObjects[i].bidfloor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want currency here?

Copy link
Contributor Author

@shahinrahbariasl shahinrahbariasl Oct 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Pat, not for now. Currency will be the same for all sizes and at imp level. We're only going to add support for floors per size for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmmccann Is there anything else you need from our end before merging?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope looks good!

}
}

Expand Down
12 changes: 12 additions & 0 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,18 @@ describe('IndexexchangeAdapter', function () {
expect(impression.banner.format[0].ext.fl).to.equal('x');
});

it('banner multi size impression should have bidFloor both in imp and format ext obejcts', function () {
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
bid.params.bidFloor = 50;
bid.params.bidFloorCur = 'USD';
const requestBidFloor = spec.buildRequests([bid], {})[0];
const impression = JSON.parse(requestBidFloor.data.r).imp[0];

expect(impression.bidfloor).to.equal(bid.params.bidFloor);
expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur);
expect(impression.banner.format[0].ext.bidfloor).to.equal(50);
});

it('missing sizes impressions should contain floors from priceFloors module ', function () {
const bid = utils.deepClone(ONE_BANNER[0]);
bid.mediaTypes.banner.sizes.push([500, 400])
Expand Down