diff --git a/modules/adoceanBidAdapter.js b/modules/adoceanBidAdapter.js index bf5596ab22a..d74a78270b2 100644 --- a/modules/adoceanBidAdapter.js +++ b/modules/adoceanBidAdapter.js @@ -2,11 +2,15 @@ import { _each, parseSizesInput, isStr, isArray } from '../src/utils.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; const BIDDER_CODE = 'adocean'; +const URL_SAFE_FIELDS = { + schain: true, + slaves: true +}; function buildEndpointUrl(emiter, payloadMap) { const payload = []; _each(payloadMap, function(v, k) { - payload.push(k + '=' + (k === 'schain' ? v : encodeURIComponent(v))); + payload.push(k + '=' + (URL_SAFE_FIELDS[k] ? v : encodeURIComponent(v))); }); const randomizedPart = Math.random().toString().slice(2); @@ -17,7 +21,8 @@ function buildRequest(masterBidRequests, masterId, gdprConsent) { let emiter; const payload = { id: masterId, - aosspsizes: [] + aosspsizes: [], + slaves: [] }; if (gdprConsent) { payload.gdpr_consent = gdprConsent.consentString || undefined; @@ -29,7 +34,7 @@ function buildRequest(masterBidRequests, masterId, gdprConsent) { } const bidIdMap = {}; - + const uniquePartLength = 10; _each(masterBidRequests, function(bid, slaveId) { if (!emiter) { emiter = bid.params.emiter; @@ -38,11 +43,13 @@ function buildRequest(masterBidRequests, masterId, gdprConsent) { const slaveSizes = parseSizesInput(bid.mediaTypes.banner.sizes).join('_'); const rawSlaveId = bid.params.slaveId.replace('adocean', ''); payload.aosspsizes.push(rawSlaveId + '~' + slaveSizes); + payload.slaves.push(rawSlaveId.slice(-uniquePartLength)); bidIdMap[slaveId] = bid.bidId; }); payload.aosspsizes = payload.aosspsizes.join('-'); + payload.slaves = payload.slaves.join(','); return { method: 'GET', diff --git a/test/spec/modules/adoceanBidAdapter_spec.js b/test/spec/modules/adoceanBidAdapter_spec.js index ba691825112..080b5bd5d1d 100644 --- a/test/spec/modules/adoceanBidAdapter_spec.js +++ b/test/spec/modules/adoceanBidAdapter_spec.js @@ -136,10 +136,12 @@ describe('AdoceanAdapter', function () { expect(request.url).to.include('gdpr_consent=' + bidderRequest.gdprConsent.consentString); }); - it('should attach sizes information to url', function () { + it('should attach sizes and slaves information to url', function () { let requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests[0].url).to.include('aosspsizes=myaozpniqismex~300x250_300x600'); + expect(requests[0].url).to.include('slaves=zpniqismex'); expect(requests[1].url).to.include('aosspsizes=myaozpniqismex~300x200_600x250'); + expect(requests[1].url).to.include('slaves=zpniqismex'); const differentSlavesBids = deepClone(bidRequests); differentSlavesBids[1].params.slaveId = 'adoceanmyaowafpdwlrks'; @@ -147,6 +149,7 @@ describe('AdoceanAdapter', function () { expect(requests.length).to.equal(1); expect(requests[0].url).to.include('aosspsizes=myaozpniqismex~300x250_300x600-myaowafpdwlrks~300x200_600x250'); expect((requests[0].url.match(/aosspsizes=/g) || []).length).to.equal(1); + expect(requests[0].url).to.include('slaves=zpniqismex,wafpdwlrks'); }); it('should attach schain parameter if available', function() {