Skip to content

Commit

Permalink
Adnuntius Bid Adapter: Fix for bid too low. (#6557)
Browse files Browse the repository at this point in the history
* Added automatic tzo and targetId to adserver request.

* Fixing issues with bid price being too low.

* Fixing issues with bid price being too low.
  • Loading branch information
mikael-lundin authored Apr 9, 2021
1 parent c3f5f85 commit 60b9d57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export const spec = {
const adUnit = serverBody.adUnits[k]
if (adUnit.matchedAdCount > 0) {
const bid = adUnit.ads[0];
const effectiveCpm = (bid.cpc && bid.cpm) ? bid.bid.amount + bid.cpm.amount : (bid.cpc) ? bid.bid.amount : (bid.cpm) ? bid.cpm.amount : 0;
bidResponses.push({
requestId: bidRequest.bid[k].bidId,
cpm: (bid.bid) ? bid.bid.amount : 0,
cpm: effectiveCpm,
width: Number(bid.creativeWidth),
height: Number(bid.creativeHeight),
creativeId: bid.creativeId,
Expand Down
8 changes: 5 additions & 3 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('adnuntiusBidAdapter', function () {
'destination': 'http://google.com'
},
'cpm': { 'amount': 5.0, 'currency': 'NOK' },
'bid': { 'amount': 5.0, 'currency': 'NOK' },
'cost': { 'amount': 5.0, 'currency': 'NOK' },
'bid': { 'amount': 0.005, 'currency': 'NOK' },
'cost': { 'amount': 0.005, 'currency': 'NOK' },
'impressionTrackingUrls': [],
'impressionTrackingUrlsEsc': [],
'adId': 'adn-id-1347343135',
Expand Down Expand Up @@ -106,12 +106,14 @@ describe('adnuntiusBidAdapter', function () {
const request = spec.buildRequests(bidRequests);
const interpretedResponse = spec.interpretResponse(serverResponse, request[0]);
const ad = serverResponse.body.adUnits[0].ads[0]
const cpm = (ad.cpc && ad.cpm) ? ad.bid.amount + ad.cpm.amount : (ad.cpm) ? ad.cpm.amount : 0;

expect(interpretedResponse).to.have.lengthOf(1);
expect(interpretedResponse[0].cpm).to.equal(ad.cpm.amount);
expect(interpretedResponse[0].width).to.equal(Number(ad.creativeWidth));
expect(interpretedResponse[0].height).to.equal(Number(ad.creativeHeight));
expect(interpretedResponse[0].creativeId).to.equal(ad.creativeId);
expect(interpretedResponse[0].currency).to.equal(ad.cpm.currency);
expect(interpretedResponse[0].currency).to.equal(ad.bid.currency);
expect(interpretedResponse[0].netRevenue).to.equal(false);
expect(interpretedResponse[0].ad).to.equal(serverResponse.body.adUnits[0].html);
expect(interpretedResponse[0].ttl).to.equal(360);
Expand Down

0 comments on commit 60b9d57

Please sign in to comment.