Skip to content

Commit a61da7d

Browse files
shahinrahbariaslshahin-rahbariasl
authored andcommitted
IX Bid Adapter: send bid floor per size in format ext (prebid#9084)
* feat: send bid floor per size in format ext [PB-1311] * fix: remove typo [PB-1311] Co-authored-by: shahin.rahbariasl <[email protected]>
1 parent 552f091 commit a61da7d

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

modules/ixBidAdapter.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,10 +809,15 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
809809
},
810810
};
811811

812-
// We add sid in imp.ext.sid therefore, remove from banner.format[].ext
813-
for (let bannerFormat of _bannerImpression.banner.format) {
814-
if (bannerFormat.ext != null && bannerFormat.ext.sid != null) {
815-
delete bannerFormat.ext.sid;
812+
for (let i = 0; i < _bannerImpression.banner.format.length; i++) {
813+
// We add sid in imp.ext.sid therefore, remove from banner.format[].ext
814+
if (_bannerImpression.banner.format[i].ext != null && _bannerImpression.banner.format[i].ext.sid != null) {
815+
delete _bannerImpression.banner.format[i].ext.sid;
816+
}
817+
818+
// add floor per size
819+
if ('bidfloor' in impressionObjects[i]) {
820+
_bannerImpression.banner.format[i].ext.bidfloor = impressionObjects[i].bidfloor
816821
}
817822
}
818823

test/spec/modules/ixBidAdapter_spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,18 @@ describe('IndexexchangeAdapter', function () {
18701870
expect(impression.banner.format[0].ext.fl).to.equal('x');
18711871
});
18721872

1873+
it('banner multi size impression should have bidFloor both in imp and format ext obejcts', function () {
1874+
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
1875+
bid.params.bidFloor = 50;
1876+
bid.params.bidFloorCur = 'USD';
1877+
const requestBidFloor = spec.buildRequests([bid], {})[0];
1878+
const impression = JSON.parse(requestBidFloor.data.r).imp[0];
1879+
1880+
expect(impression.bidfloor).to.equal(bid.params.bidFloor);
1881+
expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur);
1882+
expect(impression.banner.format[0].ext.bidfloor).to.equal(50);
1883+
});
1884+
18731885
it('missing sizes impressions should contain floors from priceFloors module ', function () {
18741886
const bid = utils.deepClone(ONE_BANNER[0]);
18751887
bid.mediaTypes.banner.sizes.push([500, 400])

0 commit comments

Comments
 (0)