Skip to content

Commit f31582b

Browse files
idsync support ccpa & gdpr
1 parent c57fc3b commit f31582b

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

modules/districtmDMXBidAdapter.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,22 @@ export const spec = {
133133
test() {
134134
return window.location.href.indexOf('dmTest=true') !== -1 ? 1 : 0;
135135
},
136-
getUserSyncs(optionsType) {
136+
getUserSyncs(optionsType, serverResponses, gdprConsent, uspConsent) {
137+
let query = [];
138+
let url = 'https://cdn.districtm.io/ids/index.html'
139+
if (gdprConsent && gdprConsent.gdprApplies && typeof gdprConsent.consentString === 'string') {
140+
query.push(['gdpr', gdprConsent.consentString])
141+
}
142+
if (uspConsent) {
143+
query.push(['ccpa', uspConsent])
144+
}
145+
if (query.length > 0) {
146+
url += '?' + query.map(q => q.join('=')).join('&')
147+
}
137148
if (optionsType.iframeEnabled) {
138149
return [{
139150
type: 'iframe',
140-
url: 'https://cdn.districtm.io/ids/index.html'
151+
url: url
141152
}];
142153
}
143154
}

test/spec/modules/districtmDmxBidAdapter_spec.js

+26
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,32 @@ describe('DistrictM Adaptor', function () {
559559
});
560560
});
561561

562+
describe(`check validation for id sync gdpr ccpa`, () => {
563+
let allin = spec.getUserSyncs({iframeEnabled: true}, {}, bidderRequest.gdprConsent, bidderRequest.uspConsent)[0]
564+
let noCCPA = spec.getUserSyncs({iframeEnabled: true}, {}, bidderRequest.gdprConsent, null)[0]
565+
let noGDPR = spec.getUserSyncs({iframeEnabled: true}, {}, null, bidderRequest.uspConsent)[0]
566+
let nothing = spec.getUserSyncs({iframeEnabled: true}, {}, null, null)[0]
567+
568+
/*
569+
570+
'uspConsent': '1NY',
571+
'gdprConsent': {
572+
'consentString': 'BOPqNzUOPqNzUAHABBAAA5AAAAAAAA',
573+
*/
574+
it(`gdpr & ccpa should be present`, () => {
575+
expect(allin.url).to.be.equal('https://cdn.districtm.io/ids/index.html?gdpr=BOPqNzUOPqNzUAHABBAAA5AAAAAAAA&ccpa=1NY')
576+
})
577+
it(`ccpa should be present`, () => {
578+
expect(noGDPR.url).to.be.equal('https://cdn.districtm.io/ids/index.html?ccpa=1NY')
579+
})
580+
it(`gdpr should be present`, () => {
581+
expect(noCCPA.url).to.be.equal('https://cdn.districtm.io/ids/index.html?gdpr=BOPqNzUOPqNzUAHABBAAA5AAAAAAAA')
582+
})
583+
it(`gdpr & ccpa shouldn't be present`, () => {
584+
expect(nothing.url).to.be.equal('https://cdn.districtm.io/ids/index.html')
585+
})
586+
})
587+
562588
describe(`Helper function testing`, function () {
563589
const bid = matchRequest('29a28a1bbc8a8d', {bidderRequest});
564590
const {width, height} = defaultSize(bid);

0 commit comments

Comments
 (0)