From f0adee03d305c8cbe85974ed0f7a89c72e8495b5 Mon Sep 17 00:00:00 2001 From: Antonios Sarhanis Date: Fri, 13 Dec 2024 00:56:47 +1100 Subject: [PATCH] Reading advertiserDomains from adv response. (#12573) --- modules/adnuntiusBidAdapter.js | 10 ++++++---- test/spec/modules/adnuntiusBidAdapter_spec.js | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/adnuntiusBidAdapter.js b/modules/adnuntiusBidAdapter.js index cce1b5332ad..2747000c416 100644 --- a/modules/adnuntiusBidAdapter.js +++ b/modules/adnuntiusBidAdapter.js @@ -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, diff --git a/test/spec/modules/adnuntiusBidAdapter_spec.js b/test/spec/modules/adnuntiusBidAdapter_spec.js index a0846a829a8..7814c24f4ac 100644 --- a/test/spec/modules/adnuntiusBidAdapter_spec.js +++ b/test/spec/modules/adnuntiusBidAdapter_spec.js @@ -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' }, @@ -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');