Skip to content

Commit

Permalink
Add US privacy data support for LockerDome adapter (#4575)
Browse files Browse the repository at this point in the history
  • Loading branch information
margsliu authored and jsnellbaker committed Dec 11, 2019
1 parent 75036f2 commit 367cd6f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
5 changes: 5 additions & 0 deletions modules/lockerdomeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const spec = {
consent: bidderRequest.gdprConsent.consentString
};
}
if (bidderRequest.uspConsent) {
payload.us_privacy = {
consent: bidderRequest.uspConsent
}
}
}

const payloadString = JSON.stringify(payload);
Expand Down
58 changes: 35 additions & 23 deletions test/spec/modules/lockerdomeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,36 +118,48 @@ describe('LockerDomeAdapter', function () {
};
const request = spec.buildRequests(bidRequests, bidderRequest);
const requestData = JSON.parse(request.data);

expect(requestData.gdpr).to.be.an('object');
expect(requestData.gdpr).to.have.property('applies', true);
expect(requestData.gdpr).to.have.property('consent', 'AAABBB');
});
});

it('should add schain to request if available', function () {
const bidderRequest = {
refererInfo: {
canonicalUrl: 'https://example.com/canonical',
referer: 'https://example.com'
}
};
const schainExpected = {
ver: '1.0',
complete: 1,
nodes: [
{
asi: 'indirectseller.com',
sid: '00001',
hp: 1
it('should add US Privacy data to request if available', function () {
const bidderRequest = {
uspConsent: 'AAABBB',
refererInfo: {
canonicalUrl: 'https://example.com/canonical',
referer: 'https://example.com'
}
]
};
};
const request = spec.buildRequests(bidRequests, bidderRequest);
const requestData = JSON.parse(request.data);
expect(requestData.us_privacy).to.be.an('object');
expect(requestData.us_privacy).to.have.property('consent', 'AAABBB');
});

const request = spec.buildRequests(bidRequests, bidderRequest);
const requestData = JSON.parse(request.data);
expect(requestData.schain).to.be.an('object');
expect(requestData.schain).to.deep.equal(schainExpected);
it('should add schain to request if available', function () {
const bidderRequest = {
refererInfo: {
canonicalUrl: 'https://example.com/canonical',
referer: 'https://example.com'
}
};
const schainExpected = {
ver: '1.0',
complete: 1,
nodes: [
{
asi: 'indirectseller.com',
sid: '00001',
hp: 1
}
]
};
const request = spec.buildRequests(bidRequests, bidderRequest);
const requestData = JSON.parse(request.data);
expect(requestData.schain).to.be.an('object');
expect(requestData.schain).to.deep.equal(schainExpected);
});
});

describe('interpretResponse', function () {
Expand Down

0 comments on commit 367cd6f

Please sign in to comment.