Skip to content

Commit

Permalink
Alkimi bid adapter: Resolve AUCTION_PRICE macro for VAST ads (#10536)
Browse files Browse the repository at this point in the history
* Alkimi bid adapter

* Alkimi bid adapter

* Alkimi bid adapter

* alkimi adapter

* onBidWon change

* sign utils

* auction ID as bid request ID

* unit test fixes

* change maintainer info

* Updated the ad unit params

* features support added

* transfer adUnitCode

* transfer adUnitCode: test

* AlkimiBidAdapter getFloor() using

* ALK-504
Multi size ad slot support

* ALK-504
Multi size ad slot support

* Support new OpenRTB parameters

* Support new oRTB2 parameters

* remove pos parameter

* Add gvl_id into Alkimi adapter

* Insert keywords into bid-request param

* Resolve AUCTION_PRICE macro on prebid-server for VAST ads

---------

Co-authored-by: Alexander <[email protected]>
Co-authored-by: Alexander Bogdanov <[email protected]>
Co-authored-by: Alexander Bogdanov <[email protected]>
Co-authored-by: motors <[email protected]>
Co-authored-by: mihanikw2g <[email protected]>
Co-authored-by: Nikulin Mikhail <[email protected]>
Co-authored-by: mik <[email protected]>
  • Loading branch information
8 people committed Sep 28, 2023
1 parent 94a3e5b commit 24fc39d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
25 changes: 8 additions & 17 deletions modules/alkimiBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {deepAccess, deepClone, getDNT, generateUUID} from '../src/utils.js';
import {deepAccess, deepClone, getDNT, generateUUID, replaceAuctionPrice} from '../src/utils.js';
import {ajax} from '../src/ajax.js';
import {VIDEO} from '../src/mediaTypes.js';
import {VIDEO, BANNER} from '../src/mediaTypes.js';
import {config} from '../src/config.js';

const BIDDER_CODE = 'alkimi';
Expand Down Expand Up @@ -116,7 +116,7 @@ export const spec = {

// banner or video
if (VIDEO === bid.mediaType) {
bid.vastXml = bid.ad;
bid.vastUrl = replaceAuctionPrice(bid.winUrl, bid.cpm);
}

bid.meta = {};
Expand All @@ -129,21 +129,12 @@ export const spec = {
},

onBidWon: function (bid) {
let winUrl;
if (bid.winUrl || bid.vastUrl) {
winUrl = bid.winUrl ? bid.winUrl : bid.vastUrl;
winUrl = winUrl.replace(/\$\{AUCTION_PRICE}/, bid.cpm);
} else if (bid.ad) {
let trackImg = bid.ad.match(/(?!^)<img src=".+dsp-win.+">/);
bid.ad = bid.ad.replace(trackImg[0], '');
winUrl = trackImg[0].split('"')[1];
winUrl = winUrl.replace(/\$%7BAUCTION_PRICE%7D/, bid.cpm);
} else {
return false;
if (BANNER == bid.mediaType && bid.winUrl) {
const winUrl = replaceAuctionPrice(bid.winUrl, bid.cpm);
ajax(winUrl, null);
return true;
}

ajax(winUrl, null);
return true;
return false;
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/alkimiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const BIDDER_VIDEO_RESPONSE = {
'ttl': 200,
'creativeId': 2,
'netRevenue': true,
'winUrl': 'http://test.com',
'winUrl': 'http://test.com?price=${AUCTION_PRICE}',
'mediaType': 'video',
'adomain': ['test.com']
}]
Expand Down Expand Up @@ -195,9 +195,9 @@ describe('alkimiBidAdapter', function () {
expect(result[0]).to.have.property('ttl').equal(200)
expect(result[0]).to.have.property('creativeId').equal(2)
expect(result[0]).to.have.property('netRevenue').equal(true)
expect(result[0]).to.have.property('winUrl').equal('http://test.com')
expect(result[0]).to.have.property('winUrl').equal('http://test.com?price=${AUCTION_PRICE}')
expect(result[0]).to.have.property('mediaType').equal('video')
expect(result[0]).to.have.property('vastXml').equal('<xml>vast</xml>')
expect(result[0]).to.have.property('vastUrl').equal('http://test.com?price=800.4')
expect(result[0].meta).to.exist.property('advertiserDomains')
expect(result[0].meta).to.have.property('advertiserDomains').lengthOf(1)
})
Expand Down

0 comments on commit 24fc39d

Please sign in to comment.