Skip to content

Commit

Permalink
Kubient Bid Adapter: update if bidfloor is zero (#8008)
Browse files Browse the repository at this point in the history
* add uspConsent to sunc URL

* kubient: add coppa

* added test for coppa

* fix-test

* replace kdmp.kbntx.ch by matching.kubient.net
remove iframe pixel support
rename us_privacy -> usp
rename consent_str -> consent
use URLSearchParams for GET params

* fix-test-and-code

* removed URLSearchParams

* early exit for getUserSyncs, updated test

* test-back

* test-filter-settings

* test-filter-settings

* test-filter-settings

* test-filter-settings

* fix for review

* fix for review

* fix test for ci passing

* fix 2 for ci passing

* refactored-test-for-ci

* fix-for-review

* fix

* fix

* avoid sending zero bid floor if it is not defined

* do not send 0 bidfloor

Co-authored-by: Artem Aleksashkin <artem.aleksashkin@kubient.com>
Co-authored-by: Artem Aleksashkin <artem.alexashkin@yandex.ru>
  • Loading branch information
3 people committed Feb 11, 2022
1 parent 4f05f95 commit 187e5e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
19 changes: 10 additions & 9 deletions modules/kubientBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@ export const spec = {
return;
}
return validBidRequests.map(function (bid) {
let floor = 0.0;
let adSlot = {
bidId: bid.bidId,
zoneId: bid.params.zoneid || ''
};

if (typeof bid.getFloor === 'function') {
const mediaType = (Object.keys(bid.mediaTypes).length == 1) ? Object.keys(bid.mediaTypes)[0] : '*';
const sizes = bid.sizes || '*';
const floorInfo = bid.getFloor({currency: 'USD', mediaType: mediaType, size: sizes});
if (typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) {
floor = parseFloat(floorInfo.floor);
if (typeof floorInfo === 'object' && floorInfo.currency === 'USD') {
let floor = parseFloat(floorInfo.floor)
if (!isNaN(floor) && floor > 0) {
adSlot.floor = parseFloat(floorInfo.floor);
}
}
}

let adSlot = {
bidId: bid.bidId,
zoneId: bid.params.zoneid || '',
floor: floor || 0.0
};

if (bid.mediaTypes.banner) {
adSlot.banner = bid.mediaTypes.banner;
}
Expand Down
8 changes: 3 additions & 5 deletions test/spec/modules/kubientBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('KubientAdapter', function () {
},
getFloor: function(params) {
return {
floor: 0.05,
floor: 0,
currency: 'USD'
};
},
Expand Down Expand Up @@ -127,10 +127,9 @@ describe('KubientAdapter', function () {
expect(data.uspConsent).to.exist.and.to.equal(uspConsentData);
for (let j = 0; j < data['adSlots'].length; j++) {
let adSlot = data['adSlots'][i];
expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'floor', 'banner', 'schain');
expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'banner', 'schain');
expect(adSlot.bidId).to.be.a('string').and.to.equal(bidBanner.bidId);
expect(adSlot.zoneId).to.be.a('string').and.to.equal(bidBanner.params.zoneid);
expect(adSlot.floor).to.be.a('number');
expect(adSlot.schain).to.be.an('object');
expect(adSlot.banner).to.be.an('object');
}
Expand Down Expand Up @@ -202,10 +201,9 @@ describe('KubientAdapter', function () {
expect(data.uspConsent).to.exist.and.to.equal(uspConsentData);
for (let j = 0; j < data['adSlots'].length; j++) {
let adSlot = data['adSlots'][i];
expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'floor', 'banner', 'schain');
expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'banner', 'schain');
expect(adSlot.bidId).to.be.a('string').and.to.equal(bidBanner.bidId);
expect(adSlot.zoneId).to.be.a('string').and.to.equal(bidBanner.params.zoneid);
expect(adSlot.floor).to.be.a('number');
expect(adSlot.schain).to.be.an('object');
expect(adSlot.banner).to.be.an('object');
}
Expand Down

0 comments on commit 187e5e0

Please sign in to comment.