From 2450f2fb5dcb7fe3807372fa323a203763198473 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal <7393273+jaiminpanchal27@users.noreply.github.com> Date: Wed, 4 Dec 2019 15:25:47 -0500 Subject: [PATCH] adding ccpa support for appnexus bid adapter (#4531) --- modules/appnexusBidAdapter.js | 4 ++++ test/spec/modules/appnexusBidAdapter_spec.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index cb48f4cbd84..e1cb4cfc693 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -158,6 +158,10 @@ export const spec = { }; } + if (bidderRequest && bidderRequest.uspConsent) { + payload.us_privacy = bidderRequest.uspConsent + } + if (bidderRequest && bidderRequest.refererInfo) { let refererinfo = { rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer), diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index 762833f29b8..c1d307521a5 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -590,6 +590,24 @@ describe('AppNexusAdapter', function () { expect(payload.gdpr_consent.consent_required).to.exist.and.to.be.true; }); + it('should add us privacy string to payload', function() { + let consentString = '1YA-'; + let bidderRequest = { + 'bidderCode': 'appnexus', + 'auctionId': '1d1a030790a475', + 'bidderRequestId': '22edbae2733bf6', + 'timeout': 3000, + 'uspConsent': consentString + }; + bidderRequest.bids = bidRequests; + + const request = spec.buildRequests(bidRequests, bidderRequest); + const payload = JSON.parse(request.data); + + expect(payload.us_privacy).to.exist; + expect(payload.us_privacy).to.exist.and.to.equal(consentString); + }); + it('supports sending hybrid mobile app parameters', function () { let appRequest = Object.assign({}, bidRequests[0],