diff --git a/modules/dasBidAdapter.js b/modules/dasBidAdapter.js index 557ebaceed8..1327ec9f1e4 100644 --- a/modules/dasBidAdapter.js +++ b/modules/dasBidAdapter.js @@ -248,6 +248,13 @@ function buildOpenRTBRequest(bidRequests, bidderRequest) { request.ext.adbeta = customParams.adbeta; } + // AdShield anti-adblock recovery signal (set by dlApi as customParams.asd, like adbeta). + // Sent as a plain ext field (not a key-value) so das-bidder serves only + // adblock-compatible demand (adblock_compability == 2). + if (customParams.asd) { + request.ext.asd = customParams.asd; + } + if (bidderRequest.device) { request.device = bidderRequest.device; } diff --git a/test/spec/modules/dasBidAdapter_spec.js b/test/spec/modules/dasBidAdapter_spec.js index 271a1afb9f0..d8252171945 100644 --- a/test/spec/modules/dasBidAdapter_spec.js +++ b/test/spec/modules/dasBidAdapter_spec.js @@ -179,6 +179,31 @@ describe('dasBidAdapter', function () { expect(payload.imp[0].banner.format[0]).to.deep.equal({ w: 300, h: 250 }); }); + it('should route customParams.asd into ext.asd for AdShield recovery', function () { + const asdBidRequests = [{ + ...bidRequests[0], + params: { + ...bidRequests[0].params, + customParams: { asd: 1 } + } + }]; + + const request = spec.buildRequests(asdBidRequests, bidderRequest); + const params = new URLSearchParams(request.url.split('?')[1]); + const payload = JSON.parse(decodeURIComponent(params.get('data'))); + + expect(payload.ext.asd).to.equal(1); + expect(payload.ext.keyvalues.asd).to.be.undefined; + }); + + it('should not set ext.asd without customParams.asd', function () { + const request = spec.buildRequests(bidRequests, bidderRequest); + const params = new URLSearchParams(request.url.split('?')[1]); + const payload = JSON.parse(decodeURIComponent(params.get('data'))); + + expect(payload.ext.asd).to.be.undefined; + }); + it('should use GET method when URL is under 8192 characters', function () { const request = spec.buildRequests(bidRequests, bidderRequest); expect(request.method).to.equal('GET');