Skip to content

Commit

Permalink
Adkernel Bid Adapter: bid.mtype support (#11355)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckbo3hrk authored Apr 18, 2024
1 parent e576447 commit 75602dc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
12 changes: 9 additions & 3 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ const MULTI_FORMAT_SUFFIX_BANNER = 'b' + MULTI_FORMAT_SUFFIX;
const MULTI_FORMAT_SUFFIX_VIDEO = 'v' + MULTI_FORMAT_SUFFIX;
const MULTI_FORMAT_SUFFIX_NATIVE = 'n' + MULTI_FORMAT_SUFFIX;

const MEDIA_TYPES = {
BANNER: 1,
VIDEO: 2,
NATIVE: 4
};

/**
* Adapter for requesting bids from AdKernel white-label display platform
*/
Expand Down Expand Up @@ -159,17 +165,17 @@ export const spec = {
if (prBid.requestId.endsWith(MULTI_FORMAT_SUFFIX)) {
prBid.requestId = stripMultiformatSuffix(prBid.requestId);
}
if ('banner' in imp) {
if (rtbBid.mtype === MEDIA_TYPES.BANNER) {
prBid.mediaType = BANNER;
prBid.width = rtbBid.w;
prBid.height = rtbBid.h;
prBid.ad = formatAdMarkup(rtbBid);
} else if ('video' in imp) {
} else if (rtbBid.mtype === MEDIA_TYPES.VIDEO) {
prBid.mediaType = VIDEO;
prBid.vastUrl = rtbBid.nurl;
prBid.width = imp.video.w;
prBid.height = imp.video.h;
} else if ('native' in imp) {
} else if (rtbBid.mtype === MEDIA_TYPES.NATIVE) {
prBid.mediaType = NATIVE;
prBid.native = {
ortb: buildNativeAd(rtbBid.adm)
Expand Down
13 changes: 9 additions & 4 deletions test/spec/modules/adkernelBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ describe('Adkernel adapter', function () {
adm: '<!-- admarkup here -->',
w: 300,
h: 250,
dealid: 'deal'
dealid: 'deal',
mtype: 1
}]
}],
ext: {
Expand All @@ -234,7 +235,8 @@ describe('Adkernel adapter', function () {
price: 0.00145,
adid: '158801',
nurl: 'https://rtb.com/win?i=sZSYq5zYMxo_0&f=nurl',
cid: '16855'
cid: '16855',
mtype: 2
}]
}],
}, usersyncOnlyResponse = {
Expand Down Expand Up @@ -269,6 +271,7 @@ describe('Adkernel adapter', function () {
cat: ['IAB1-4', 'IAB8-16', 'IAB25-5'],
cid: '1',
crid: '4',
mtype: 4,
ext: {
'advertiser_id': 777,
'advertiser_name': 'advertiser',
Expand All @@ -290,15 +293,17 @@ describe('Adkernel adapter', function () {
adid: '158801',
adm: '<!-- admarkup -->',
nurl: 'https://rtb.com/win?i=sZSYq5zYMxo_0&f=nurl',
cid: '16855'
cid: '16855',
mtype: 1
}, {
id: 'sZSYq5zYMxo_1',
impid: 'Bid_01v__mf',
crid: '100_003',
price: 0.25,
adid: '158801',
nurl: 'https://rtb.com/win?i=sZSYq5zYMxo_1&f=nurl',
cid: '16855'
cid: '16855',
mtype: 2
}]
}],
bidid: 'pTuOlf5KHUo',
Expand Down

0 comments on commit 75602dc

Please sign in to comment.