Skip to content

Commit 4487f9e

Browse files
mikael-lundinstsepelin
authored andcommitted
Adnuntius Bid Adapter: Fix for bid too low. (prebid#6557)
* Added automatic tzo and targetId to adserver request. * Fixing issues with bid price being too low. * Fixing issues with bid price being too low.
1 parent 48ea3d6 commit 4487f9e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

modules/adnuntiusBidAdapter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ export const spec = {
4949
const adUnit = serverBody.adUnits[k]
5050
if (adUnit.matchedAdCount > 0) {
5151
const bid = adUnit.ads[0];
52+
const effectiveCpm = (bid.cpc && bid.cpm) ? bid.bid.amount + bid.cpm.amount : (bid.cpc) ? bid.bid.amount : (bid.cpm) ? bid.cpm.amount : 0;
5253
bidResponses.push({
5354
requestId: bidRequest.bid[k].bidId,
54-
cpm: (bid.bid) ? bid.bid.amount : 0,
55+
cpm: effectiveCpm,
5556
width: Number(bid.creativeWidth),
5657
height: Number(bid.creativeHeight),
5758
creativeId: bid.creativeId,

test/spec/modules/adnuntiusBidAdapter_spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ describe('adnuntiusBidAdapter', function () {
4848
'destination': 'http://google.com'
4949
},
5050
'cpm': { 'amount': 5.0, 'currency': 'NOK' },
51-
'bid': { 'amount': 5.0, 'currency': 'NOK' },
52-
'cost': { 'amount': 5.0, 'currency': 'NOK' },
51+
'bid': { 'amount': 0.005, 'currency': 'NOK' },
52+
'cost': { 'amount': 0.005, 'currency': 'NOK' },
5353
'impressionTrackingUrls': [],
5454
'impressionTrackingUrlsEsc': [],
5555
'adId': 'adn-id-1347343135',
@@ -106,12 +106,14 @@ describe('adnuntiusBidAdapter', function () {
106106
const request = spec.buildRequests(bidRequests);
107107
const interpretedResponse = spec.interpretResponse(serverResponse, request[0]);
108108
const ad = serverResponse.body.adUnits[0].ads[0]
109+
const cpm = (ad.cpc && ad.cpm) ? ad.bid.amount + ad.cpm.amount : (ad.cpm) ? ad.cpm.amount : 0;
110+
109111
expect(interpretedResponse).to.have.lengthOf(1);
110112
expect(interpretedResponse[0].cpm).to.equal(ad.cpm.amount);
111113
expect(interpretedResponse[0].width).to.equal(Number(ad.creativeWidth));
112114
expect(interpretedResponse[0].height).to.equal(Number(ad.creativeHeight));
113115
expect(interpretedResponse[0].creativeId).to.equal(ad.creativeId);
114-
expect(interpretedResponse[0].currency).to.equal(ad.cpm.currency);
116+
expect(interpretedResponse[0].currency).to.equal(ad.bid.currency);
115117
expect(interpretedResponse[0].netRevenue).to.equal(false);
116118
expect(interpretedResponse[0].ad).to.equal(serverResponse.body.adUnits[0].html);
117119
expect(interpretedResponse[0].ttl).to.equal(360);

0 commit comments

Comments
 (0)