Skip to content

Commit

Permalink
FreeWheelAdapter-CCPA support CCPA consent in freeWheelSSPAdapter (pr…
Browse files Browse the repository at this point in the history
…ebid#4695)

* FreeWheelAdapter-CCPA support CCPA in freeWheelSSPAdapter

* FreeWheelAdapter-CCPA add test cases

* FreeWheelAdapter-CCPA remove console log from tests
  • Loading branch information
xwang202 authored and jsnellbaker committed Jan 9, 2020
1 parent f7f79c3 commit a4d7191
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
5 changes: 5 additions & 0 deletions modules/freewheel-sspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ export const spec = {
requestParams._fw_gdpr_consented_providers = currentBidRequest.params.gdpr_consented_providers;
}

// Add CCPA consent string
if (bidderRequest && bidderRequest.uspConsent) {
requestParams._fw_us_privacy = bidderRequest.uspConsent;
}

var vastParams = currentBidRequest.params.vastUrlParams;
if (typeof vastParams === 'object') {
for (var key in vastParams) {
Expand Down
35 changes: 34 additions & 1 deletion test/spec/modules/freewheel-sspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ describe('freewheelSSP BidAdapter Test', () => {

it('should add parameters to the tag', () => {
const request = spec.buildRequests(bidRequests);

const payload = request.data;
expect(payload.reqType).to.equal('AdsSetup');
expect(payload.protocolVersion).to.equal('2.0');
Expand All @@ -85,6 +84,40 @@ describe('freewheelSSP BidAdapter Test', () => {
expect(request.url).to.contain(ENDPOINT);
expect(request.method).to.equal('GET');
});

it('should add usp consent to the request', () => {
let uspConsentString = '1FW-SSP-uspConsent-';
let bidderRequest = {};
bidderRequest.uspConsent = uspConsentString;
const request = spec.buildRequests(bidRequests, bidderRequest);
const payload = request.data;
expect(payload.reqType).to.equal('AdsSetup');
expect(payload.protocolVersion).to.equal('2.0');
expect(payload.zoneId).to.equal('277225');
expect(payload.componentId).to.equal('mustang');
expect(payload.playerSize).to.equal('300x600');
expect(payload._fw_us_privacy).to.exist.and.to.be.a('string');
expect(payload._fw_us_privacy).to.equal(uspConsentString);
});

it('should add gdpr consent to the request', () => {
let gdprConsentString = '1FW-SSP-gdprConsent-';
let bidderRequest = {
'gdprConsent': {
'consentString': gdprConsentString
}
};

const request = spec.buildRequests(bidRequests, bidderRequest);
const payload = request.data;
expect(payload.reqType).to.equal('AdsSetup');
expect(payload.protocolVersion).to.equal('2.0');
expect(payload.zoneId).to.equal('277225');
expect(payload.componentId).to.equal('mustang');
expect(payload.playerSize).to.equal('300x600');
expect(payload._fw_gdpr_consent).to.exist.and.to.be.a('string');
expect(payload._fw_gdpr_consent).to.equal(gdprConsentString);
});
})

describe('interpretResponse', () => {
Expand Down

0 comments on commit a4d7191

Please sign in to comment.