From 8a4c3a00bcf8285d6327506165bf87c8e7d09f60 Mon Sep 17 00:00:00 2001 From: skoklowski Date: Wed, 14 Jan 2026 15:57:00 +0100 Subject: [PATCH 1/2] dasBidAdapter: add bidder_variant to adserverTargeting in interpretResponse --- modules/dasBidAdapter.js | 7 +++++ test/spec/modules/dasBidAdapter_spec.js | 35 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/modules/dasBidAdapter.js b/modules/dasBidAdapter.js index 954da2265bb..82892b96d5a 100644 --- a/modules/dasBidAdapter.js +++ b/modules/dasBidAdapter.js @@ -298,6 +298,13 @@ function interpretResponse(serverResponse) { }, }; + const bidderVariant = bid.ext?.bidder_variant; + if (bidderVariant) { + bidResponse.adserverTargeting = { + 'bidder_variant': bidderVariant + }; + } + if (bid.mtype === 1) { bidResponse.mediaType = BANNER; bidResponse.ad = bid.adm; diff --git a/test/spec/modules/dasBidAdapter_spec.js b/test/spec/modules/dasBidAdapter_spec.js index 825c7973ddd..8887060e8c5 100644 --- a/test/spec/modules/dasBidAdapter_spec.js +++ b/test/spec/modules/dasBidAdapter_spec.js @@ -338,6 +338,41 @@ describe('dasBidAdapter', function () { expect(spec.interpretResponse({ body: { seatbid: [] } })).to.be.an('array').that.is.empty; }); + it('should include adserverTargeting with bidder_variant when present in ext', function () { + const responseWithVariant = { + body: { + seatbid: [{ + bid: [{ + impid: 'bid123', + price: 3.5, + w: 300, + h: 250, + adm: '', + crid: 'crid123', + mtype: 1, + adomain: ['advertiser.com'], + ext: { + bidder_variant: 'variant_a' + } + }] + }], + cur: 'USD' + } + }; + + const bidResponses = spec.interpretResponse(responseWithVariant); + + expect(bidResponses[0].adserverTargeting).to.deep.equal({ + 'bidder_variant': 'variant_a' + }); + }); + + it('should not include adserverTargeting when bidder_variant is not present', function () { + const bidResponses = spec.interpretResponse(serverResponse); + + expect(bidResponses[0].adserverTargeting).to.be.undefined; + }); + it('should return proper bid response for native', function () { const nativeResponse = { body: { From b3a9abed8dde32d5bdc7a7f17e98f96c1add1568 Mon Sep 17 00:00:00 2001 From: skoklowski Date: Thu, 15 Jan 2026 12:23:22 +0100 Subject: [PATCH 2/2] DAS Adapter: update interpretResponse to use targeting object for adserverTargeting --- modules/dasBidAdapter.js | 8 ++--- test/spec/modules/dasBidAdapter_spec.js | 45 ++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/modules/dasBidAdapter.js b/modules/dasBidAdapter.js index 82892b96d5a..a01aaa96149 100644 --- a/modules/dasBidAdapter.js +++ b/modules/dasBidAdapter.js @@ -298,11 +298,9 @@ function interpretResponse(serverResponse) { }, }; - const bidderVariant = bid.ext?.bidder_variant; - if (bidderVariant) { - bidResponse.adserverTargeting = { - 'bidder_variant': bidderVariant - }; + const targeting = bid.ext?.targeting; + if (targeting) { + bidResponse.adserverTargeting = targeting; } if (bid.mtype === 1) { diff --git a/test/spec/modules/dasBidAdapter_spec.js b/test/spec/modules/dasBidAdapter_spec.js index 8887060e8c5..d38592e47c4 100644 --- a/test/spec/modules/dasBidAdapter_spec.js +++ b/test/spec/modules/dasBidAdapter_spec.js @@ -338,8 +338,8 @@ describe('dasBidAdapter', function () { expect(spec.interpretResponse({ body: { seatbid: [] } })).to.be.an('array').that.is.empty; }); - it('should include adserverTargeting with bidder_variant when present in ext', function () { - const responseWithVariant = { + it('should include adserverTargeting when targeting is present in ext', function () { + const responseWithTargeting = { body: { seatbid: [{ bid: [{ @@ -352,7 +352,9 @@ describe('dasBidAdapter', function () { mtype: 1, adomain: ['advertiser.com'], ext: { - bidder_variant: 'variant_a' + targeting: { + bidder_variant: 'variant_a' + } } }] }], @@ -360,14 +362,47 @@ describe('dasBidAdapter', function () { } }; - const bidResponses = spec.interpretResponse(responseWithVariant); + const bidResponses = spec.interpretResponse(responseWithTargeting); expect(bidResponses[0].adserverTargeting).to.deep.equal({ 'bidder_variant': 'variant_a' }); }); - it('should not include adserverTargeting when bidder_variant is not present', function () { + it('should pass through all targeting keys from server', function () { + const responseWithMultipleTargeting = { + body: { + seatbid: [{ + bid: [{ + impid: 'bid123', + price: 3.5, + w: 300, + h: 250, + adm: '', + crid: 'crid123', + mtype: 1, + adomain: ['advertiser.com'], + ext: { + targeting: { + bidder_variant: 'variant_a', + custom_key: 'custom_value' + } + } + }] + }], + cur: 'USD' + } + }; + + const bidResponses = spec.interpretResponse(responseWithMultipleTargeting); + + expect(bidResponses[0].adserverTargeting).to.deep.equal({ + 'bidder_variant': 'variant_a', + 'custom_key': 'custom_value' + }); + }); + + it('should not include adserverTargeting when targeting is not present', function () { const bidResponses = spec.interpretResponse(serverResponse); expect(bidResponses[0].adserverTargeting).to.be.undefined;