Skip to content

Commit d88e808

Browse files
Districtm Dmx adding Coppa support (#4997)
* idsync support ccpa & gdpr * adding support for COPPA * using proposition to change COPPA setting in dmx adapter * adding support for liveramp * update md file
1 parent 37352f3 commit d88e808

File tree

3 files changed

+87
-4
lines changed

3 files changed

+87
-4
lines changed

modules/districtmDMXBidAdapter.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const spec = {
7272
publisher: { id: String(bidRequest[0].params.memberid) || null }
7373
}
7474
}
75+
7576
try {
7677
let params = config.getConfig('dmx');
7778
dmxRequest.user = params.user || {};
@@ -80,6 +81,14 @@ export const spec = {
8081
} catch (e) {
8182

8283
}
84+
85+
let eids = [];
86+
if (bidRequest && bidRequest.userId) {
87+
bindUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1);
88+
dmxRequest.user = dmxRequest.user || {};
89+
dmxRequest.user.ext = dmxRequest.user.ext || {};
90+
dmxRequest.user.ext.eids = eids;
91+
}
8392
if (!dmxRequest.test) {
8493
delete dmxRequest.test;
8594
}
@@ -91,6 +100,8 @@ export const spec = {
91100
dmxRequest.user.ext = {};
92101
dmxRequest.user.ext.consent = bidderRequest.gdprConsent.consentString;
93102
}
103+
dmxRequest.regs = dmxRequest.regs || {};
104+
dmxRequest.regs.coppa = config.getConfig('coppa') === true ? 1 : 0;
94105
if (bidderRequest && bidderRequest.uspConsent) {
95106
dmxRequest.regs = dmxRequest.regs || {};
96107
dmxRequest.regs.ext = dmxRequest.regs.ext || {};
@@ -281,4 +292,18 @@ export function defaultSize(thebidObj) {
281292
returnObject.height = checkDeepArray(sizes)[1];
282293
return returnObject;
283294
}
295+
296+
export function bindUserId(eids, value, source, atype) {
297+
if (utils.isStr(value) && Array.isArray(eids)) {
298+
eids.push({
299+
source,
300+
uids: [
301+
{
302+
id: value,
303+
atype
304+
}
305+
]
306+
})
307+
}
308+
}
284309
registerBidder(spec);

modules/districtmDmxBidAdapter.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The `districtmDmxAdapter` module allows publishers to include DMX Exchange deman
1313
* Single Request
1414
* Multi-Size Support
1515
* GDPR Compliant
16+
* CCPA Compliant
17+
* COPPA Compliant
1618
* Bids returned in **NET**
1719

1820
## Media Types
@@ -23,8 +25,8 @@ The `districtmDmxAdapter` module allows publishers to include DMX Exchange deman
2325

2426
| Key | Scope | Type | Description
2527
| --- | --- | --- | ---
26-
| dmxid | Mandatory | Integer | Unique identifier of the placement, dmxid can be obtained in the district m Boost platform.
27-
| memberid | Mandatory | Integer | Unique identifier for your account, memberid can be obtained in the district m Boost platform.
28+
| `dmxid` | Mandatory | Integer | Unique identifier of the placement, dmxid can be obtained in the district m Boost platform.
29+
| `memberid` | Mandatory | Integer | Unique identifier for your account, memberid can be obtained in the district m Boost platform.
2830

2931
# Ad Unit Configuration Example
3032

@@ -47,6 +49,9 @@ The `districtmDmxAdapter` module allows publishers to include DMX Exchange deman
4749
```
4850

4951

52+
# Ad Unit Configuration when COPPA is needed
53+
54+
5055
# Quick Start Guide
5156

5257
###### 1. Including the `districtmDmxAdapter` in your build process.

test/spec/modules/districtmDmxBidAdapter_spec.js

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const bidRequest = [{
4040
'bidder': 'districtmDMX',
4141
'params': {
4242
'dmxid': 100001,
43-
'memberid': 100003
43+
'memberid': 100003,
4444
},
4545
'adUnitCode': 'div-gpt-ad-12345678-1',
4646
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
@@ -53,6 +53,22 @@ const bidRequest = [{
5353
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
5454
}];
5555

56+
const bidRequestNoCoppa = [{
57+
'bidder': 'districtmDMX',
58+
'params': {
59+
'dmxid': 100001,
60+
'memberid': 100003
61+
},
62+
'adUnitCode': 'div-gpt-ad-12345678-1',
63+
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
64+
'sizes': [
65+
[300, 250],
66+
[300, 600]
67+
],
68+
'bidId': '29a28a1bbc8a8d',
69+
'bidderRequestId': '124b579a136515',
70+
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
71+
}];
5672
const bidderRequest = {
5773
'bidderCode': 'districtmDMX',
5874
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf',
@@ -61,7 +77,7 @@ const bidderRequest = {
6177
'bidder': 'districtmDMX',
6278
'params': {
6379
'dmxid': 100001,
64-
'memberid': 100003
80+
'memberid': 100003,
6581
},
6682
'adUnitCode': 'div-gpt-ad-12345678-1',
6783
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
@@ -420,6 +436,32 @@ const bidderRequest = {
420436
'doneCbCallCount': 0
421437
};
422438

439+
const bidderRequestNoCoppa = {
440+
'bidderCode': 'districtmDMX',
441+
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf',
442+
'bidderRequestId': '124b579a136515',
443+
'bids': [{
444+
'bidder': 'districtmDMX',
445+
'params': {
446+
'dmxid': 100001,
447+
'memberid': 100003,
448+
},
449+
'adUnitCode': 'div-gpt-ad-12345678-1',
450+
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
451+
'sizes': [
452+
[300, 250],
453+
[300, 600]
454+
],
455+
'bidId': '29a28a1bbc8a8d',
456+
'bidderRequestId': '124b579a136515',
457+
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
458+
}],
459+
'auctionStart': 1529511035677,
460+
'timeout': 700,
461+
'start': 1529511035686,
462+
'doneCbCallCount': 0
463+
};
464+
423465
const responses = {
424466
'body': {
425467
'id': '1f45b37c-5298-4934-b517-4d911aadabfd',
@@ -522,6 +564,7 @@ describe('DistrictM Adaptor', function () {
522564

523565
describe(`buildRequests test usage`, function () {
524566
const buildRequestResults = districtm.buildRequests(bidRequest, bidderRequest);
567+
const buildRequestResultsNoCoppa = districtm.buildRequests(bidRequestNoCoppa, bidderRequestNoCoppa);
525568
it(`the function should return an array`, function () {
526569
expect(buildRequestResults).to.be.an('object');
527570
});
@@ -531,6 +574,16 @@ describe('DistrictM Adaptor', function () {
531574
expect(bidr.regs.ext.us_privacy).to.be.equal('1NY');
532575
expect(bidr.user.ext.consent).to.be.an('string');
533576
});
577+
it(`test contain COPPA`, function() {
578+
const bidr = JSON.parse(buildRequestResults.data)
579+
bidr.regs = bidr.regs || {};
580+
bidr.regs.coppa = 1;
581+
expect(bidr.regs.coppa).to.be.equal(1)
582+
})
583+
it(`test should not contain COPPA`, function() {
584+
const bidr = JSON.parse(buildRequestResultsNoCoppa.data)
585+
expect(bidr.regs.coppa).to.be.equal(0)
586+
})
534587
it(`the function should return array length of 1`, function () {
535588
expect(buildRequestResults.data).to.be.a('string');
536589
});

0 commit comments

Comments
 (0)