Skip to content

Commit

Permalink
Adagio Bid Adapter: handle meta.advertiserDomains (and more) (prebid#…
Browse files Browse the repository at this point in the history
…6781)

Related to prebid#6650
  • Loading branch information
osazos authored and stsepelin committed May 28, 2021
1 parent 14887cb commit 4f206e9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
6 changes: 5 additions & 1 deletion modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { OUTSTREAM } from '../src/video.js';

export const BIDDER_CODE = 'adagio';
export const LOG_PREFIX = 'Adagio:';
export const VERSION = '2.8.0';
export const VERSION = '2.10.0';
export const FEATURES_VERSION = '1';
export const ENDPOINT = 'https://mp.4dex.io/prebid';
export const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
Expand Down Expand Up @@ -1019,6 +1019,10 @@ export const spec = {
const bidReq = (find(bidRequest.data.adUnits, bid => bid.bidId === bidObj.requestId));

if (bidReq) {
bidObj.meta = utils.deepAccess(bidObj, 'meta', {});
bidObj.meta.mediaType = bidObj.mediaType;
bidObj.meta.advertiserDomains = (Array.isArray(bidObj.aDomain) && bidObj.aDomain.length) ? bidObj.aDomain : [];

if (bidObj.mediaType === VIDEO) {
const mediaTypeContext = utils.deepAccess(bidReq, 'mediaTypes.video.context');
// Adagio SSP returns a `vastXml` only. No `vastUrl` nor `videoCacheKey`.
Expand Down
51 changes: 49 additions & 2 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,14 @@ describe('Adagio bid adapter', () => {
netRevenue: true,
requestId: 'c180kg4267tyqz',
ttl: 360,
width: 300
width: 300,
aDomain: ['advertiser.com'],
mediaType: 'banner',
meta: {
advertiserId: '80',
advertiserName: 'An Advertiser',
networkId: '110'
}
}]
}
};
Expand Down Expand Up @@ -821,13 +828,53 @@ describe('Adagio bid adapter', () => {
pagetype: 'ARTICLE',
category: 'NEWS',
subcategory: 'SPORT',
environment: 'desktop'
environment: 'desktop',
aDomain: ['advertiser.com'],
mediaType: 'banner',
meta: {
advertiserId: '80',
advertiserName: 'An Advertiser',
advertiserDomains: ['advertiser.com'],
networkId: '110',
mediaType: 'banner'
}
}];

expect(spec.interpretResponse(serverResponse, bidRequest)).to.be.an('array');
expect(spec.interpretResponse(serverResponse, bidRequest)).to.deep.equal(expectedResponse);
});

it('Meta props should be limited if no bid.meta is provided', function() {
const altServerResponse = utils.deepClone(serverResponse);
delete altServerResponse.body.bids[0].meta;

let expectedResponse = [{
ad: '<div style="background-color:red; height:250px; width:300px"></div>',
cpm: 1,
creativeId: 'creativeId',
currency: 'EUR',
height: 250,
netRevenue: true,
requestId: 'c180kg4267tyqz',
ttl: 360,
width: 300,
placement: 'PAVE_ATF',
site: 'SITE-NAME',
pagetype: 'ARTICLE',
category: 'NEWS',
subcategory: 'SPORT',
environment: 'desktop',
aDomain: ['advertiser.com'],
mediaType: 'banner',
meta: {
advertiserDomains: ['advertiser.com'],
mediaType: 'banner'
}
}];

expect(spec.interpretResponse(altServerResponse, bidRequest)).to.deep.equal(expectedResponse);
});

it('should populate ADAGIO queue with ssp-data', function() {
sandbox.stub(Date, 'now').returns(12345);

Expand Down

0 comments on commit 4f206e9

Please sign in to comment.