diff --git a/modules/a4gBidAdapter.js b/modules/a4gBidAdapter.js index f961db718c7..d6c0fa0b303 100644 --- a/modules/a4gBidAdapter.js +++ b/modules/a4gBidAdapter.js @@ -22,7 +22,7 @@ export const spec = { return bid.params && !!bid.params.zoneId; }, - buildRequests: function(validBidRequests) { + buildRequests: function(validBidRequests, bidderRequest) { let deliveryUrl = ''; const idParams = []; const sizeParams = []; @@ -41,16 +41,25 @@ export const spec = { deliveryUrl = A4G_DEFAULT_BID_URL; } + let data = { + [IFRAME_PARAM_NAME]: 0, + [LOCATION_PARAM_NAME]: utils.getTopWindowUrl(), + [SIZE_PARAM_NAME]: sizeParams.join(ARRAY_PARAM_SEPARATOR), + [ID_PARAM_NAME]: idParams.join(ARRAY_PARAM_SEPARATOR), + [ZONE_ID_PARAM_NAME]: zoneIds.join(ARRAY_PARAM_SEPARATOR) + }; + + if (bidderRequest && bidderRequest.gdprConsent) { + data.gdpr = { + applies: bidderRequest.gdprConsent.gdprApplies, + consent: bidderRequest.gdprConsent.consentString + }; + } + return { method: 'GET', url: deliveryUrl, - data: { - [IFRAME_PARAM_NAME]: 0, - [LOCATION_PARAM_NAME]: utils.getTopWindowUrl(), - [SIZE_PARAM_NAME]: sizeParams.join(ARRAY_PARAM_SEPARATOR), - [ID_PARAM_NAME]: idParams.join(ARRAY_PARAM_SEPARATOR), - [ZONE_ID_PARAM_NAME]: zoneIds.join(ARRAY_PARAM_SEPARATOR) - } + data: data }; }, diff --git a/test/spec/modules/a4gBidAdapter_spec.js b/test/spec/modules/a4gBidAdapter_spec.js index 30fcb2f8497..84346a1149f 100644 --- a/test/spec/modules/a4gBidAdapter_spec.js +++ b/test/spec/modules/a4gBidAdapter_spec.js @@ -77,6 +77,26 @@ describe('a4gAdapterTests', () => { const request = spec.buildRequests(bidRequests); expect(request.data.zoneId).to.equal('59304;59354'); }); + + it('bidRequest gdpr consent', () => { + const consentString = 'consentString'; + const bidderRequest = { + bidderCode: 'a4g', + auctionId: '18fd8b8b0bd757', + bidderRequestId: '418b37f85e772c', + timeout: 3000, + gdprConsent: { + consentString: consentString, + gdprApplies: true + } + }; + + const request = spec.buildRequests(bidRequests, bidderRequest); + + expect(request.data.gdpr).to.exist; + expect(request.data.gdpr.applies).to.exist.and.to.be.true; + expect(request.data.gdpr.consent).to.exist.and.to.equal(consentString); + }); }); describe('interpretResponse', () => {