Skip to content

Commit

Permalink
Reading advertiserDomains from adv response. (prebid#12573)
Browse files Browse the repository at this point in the history
  • Loading branch information
antosarho authored Dec 12, 2024
1 parent 0aa1fc0 commit f0adee0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,12 @@ export const spec = {
}

function buildAdResponse(bidderCode, ad, adUnit, dealCount) {
const destinationUrls = ad.destinationUrls || {};
const advertiserDomains = [];
for (const value of Object.values(destinationUrls)) {
advertiserDomains.push(value.split('/')[2])
const advertiserDomains = ad.advertiserDomains || [];
if (advertiserDomains.length === 0) {
const destinationUrls = ad.destinationUrls || {};
for (const value of Object.values(destinationUrls)) {
advertiserDomains.push(value.split('/')[2])
}
}
const adResponse = {
bidderCode: bidderCode,
Expand Down
6 changes: 4 additions & 2 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ describe('adnuntiusBidAdapter', function () {
'urlsEsc': {
'destination': 'https%3A%2F%2Fads.adnuntius.delivery%2Fc%2FyQtMUwYBn5P4v72WJMqLW4z7uJOBFXJTfjoRyz0z_wsAAAAQCtjQz9kbGWD4nuZy3q6HaCYxq6Lckz2kThplNb227EJdQ5032jcIGkf-UrPmXCU2EbXVaQ3Ok6_FNLuIDTONJyx6ZZCB10wGqA3OaSe1EqwQp84u1_5iQZAWDk73UYf7_vcIypn7ev-SICZ3qaevb2jYSRqTVZx6AiBZQQGlzlOOrbZU9AU1F-JwTds-YV3qtJHGlxI2peWFIuxFlOYyeX9Kzg%3Fct%3D673%26r%3Dhttp%253A%252F%252Fadnuntius.com'
},
'advertiserDomains': ['fred.com', 'george.com'],
'destinationUrls': {
'destination': 'https://adnuntius.com'
},
Expand Down Expand Up @@ -1255,8 +1256,9 @@ describe('adnuntiusBidAdapter', function () {
expect(interpretedResponse[0].currency).to.equal(deal.bid.currency);
expect(interpretedResponse[0].netRevenue).to.equal(false);
expect(interpretedResponse[0].meta).to.have.property('advertiserDomains');
expect(interpretedResponse[0].meta.advertiserDomains).to.have.lengthOf(1);
expect(interpretedResponse[0].meta.advertiserDomains[0]).to.equal('adnuntius.com');
expect(interpretedResponse[0].meta.advertiserDomains).to.have.lengthOf(2);
expect(interpretedResponse[0].meta.advertiserDomains[0]).to.equal('fred.com');
expect(interpretedResponse[0].meta.advertiserDomains[1]).to.equal('george.com');
expect(interpretedResponse[0].ad).to.equal(serverResponse.body.adUnits[0].deals[0].html);
expect(interpretedResponse[0].ttl).to.equal(360);
expect(interpretedResponse[0].dealId).to.equal('abc123xyz');
Expand Down

0 comments on commit f0adee0

Please sign in to comment.