Skip to content

Commit

Permalink
Yieldmo adapter: add meta data to bids (prebid#6550)
Browse files Browse the repository at this point in the history
  • Loading branch information
ym-atsymuk authored and marc_tappx committed Apr 13, 2021
1 parent 35de47d commit 955c472
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ function createNewBannerBid(response) {
netRevenue: NET_REVENUE,
ttl: TIME_TO_LIVE,
ad: response.ad,
meta: {
advertiserDomains: response.adomain || [],
mediaType: BANNER,
},
};
}

Expand All @@ -209,7 +213,11 @@ function createNewVideoBid(response, bidRequest) {
netRevenue: NET_REVENUE,
mediaType: VIDEO,
ttl: TIME_TO_LIVE,
vastXml: response.adm
vastXml: response.adm,
meta: {
advertiserDomains: response.adomain || [],
mediaType: VIDEO,
},
};
}

Expand Down
54 changes: 54 additions & 0 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ describe('YieldmoAdapter', function () {
ad: '<html><head></head><body><script>//GEX ad object</script>' +
'<div id="ym_123" class="ym"></div><script>//js code</script></body></html>',
creative_id: '9874652394875',
adomain: ['www.example.com'],
}],
header: 'header?',
});
Expand All @@ -296,6 +297,59 @@ describe('YieldmoAdapter', function () {
ttl: 300,
ad: '<html><head></head><body><script>//GEX ad object</script>' +
'<div id="ym_123" class="ym"></div><script>//js code</script></body></html>',
meta: {
advertiserDomains: ['www.example.com'],
mediaType: 'banner',
},
});
});

it('should correctly reorder video bids', function () {
const response = mockServerResponse();
const seatbid = [
{
bid: {
adm: '<?xml version="1.0" encoding="UTF-8"?>',
adomain: ['www.example.com'],
crid: 'dd65c0a7536aff',
impid: '91ea8bba1',
price: 1.5,
},
},
];
const bidRequest = {
data: {
imp: [
{
id: '91ea8bba1',
video: {
h: 250,
w: 300,
},
},
],
},
};

response.body.seatbid = seatbid;

const newResponse = spec.interpretResponse(response, bidRequest);
expect(newResponse.length).to.be.equal(2);
expect(newResponse[1]).to.deep.equal({
cpm: 1.5,
creativeId: 'dd65c0a7536aff',
currency: 'USD',
height: 250,
mediaType: 'video',
meta: {
advertiserDomains: ['www.example.com'],
mediaType: 'video',
},
netRevenue: true,
requestId: '91ea8bba1',
ttl: 300,
vastXml: '<?xml version="1.0" encoding="UTF-8"?>',
width: 300,
});
});

Expand Down

0 comments on commit 955c472

Please sign in to comment.