Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Districtm Dmx adding Coppa support #4997

Merged
merged 43 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5711b57
adding DMX
Nov 17, 2016
ad33b56
Update districtm_spec.js
stevealliance Nov 30, 2016
fbd31ff
Update districtmDMX.js
stevealliance Nov 30, 2016
fe94313
updating repo fork in github
Oct 26, 2017
6054a04
Merge pull request #1 from prebid/master
stevealliance Jun 22, 2018
0384c75
adding all districtm needed file
Jun 22, 2018
d2f5de2
remove legacy file
Jun 22, 2018
d83db11
remove typo || 0 in the test method
Jun 22, 2018
a7d0a85
force default to return a valid width and height
Jun 27, 2018
d73cac7
update unit test code for failing test
Jun 27, 2018
d5b2617
changed class for an object
Jul 9, 2018
c80b0df
remove package-lock.json
Jul 9, 2018
afa5d3e
change file name for dmx adapter
Jul 11, 2018
4e93b06
remove package-lock.json
Jul 11, 2018
afdbd9e
update fork
Jul 31, 2018
5cc3181
renamed files
Jul 31, 2018
e3e864d
restaure package-lock.json
Jul 31, 2018
6af65f9
update to last package-lock state
Jul 31, 2018
4da8f60
Merge branch 'master' of https://github.com/prebid/Prebid.js
Aug 14, 2018
15954f2
Merge branch 'master' of https://github.com/prebid/Prebid.js
Aug 27, 2018
af73067
update gdpr user consent
Aug 27, 2018
c2e2f5f
fix sizes issue
Aug 27, 2018
0f83dab
Documentation updates
lsv1 Aug 29, 2018
787e1e0
Merge pull request #3 from lsv1/patch-1
stevealliance Aug 29, 2018
a63b92b
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 4, 2018
3dfb282
update file name and update unit testing import file location
Sep 4, 2018
5786375
Merge branch 'master' of https://github.com/stevealliance/Prebid.js
Sep 4, 2018
60f693e
update remote to reflect forked repo
Jun 17, 2019
1f03347
Mdding all file to localserge branch 'master' of github.com:prebid/Pr…
Oct 23, 2019
a3d85d7
current machine state
Oct 23, 2019
a327932
lint correction
Oct 23, 2019
1706bd1
remove variable assigment duplicate
Oct 23, 2019
9492b32
adding change to dmx
steve-a-districtm Nov 6, 2019
5660324
Merge pull request #4 from prebid/master
stevealliance Dec 9, 2019
f006e29
adding CCPA support for DMX
steve-a-districtm Dec 9, 2019
c6b689b
adding test for ccpa and gdpr
steve-a-districtm Dec 13, 2019
c57fc3b
districtm dmx adding deal id field
stevealliance Jan 21, 2020
f31582b
idsync support ccpa & gdpr
steve-a-districtm Feb 17, 2020
774dd31
Merge pull request #5 from prebid/master
stevealliance Mar 18, 2020
0494164
adding support for COPPA
steve-a-districtm Mar 18, 2020
f07cbc6
using proposition to change COPPA setting in dmx adapter
steve-a-districtm Mar 21, 2020
81428a7
adding support for liveramp
steve-a-districtm Mar 22, 2020
6b1df63
update md file
steve-a-districtm Mar 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions modules/districtmDMXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const spec = {
publisher: { id: String(bidRequest[0].params.memberid) || null }
}
}

try {
let params = config.getConfig('dmx');
dmxRequest.user = params.user || {};
Expand All @@ -80,6 +81,14 @@ export const spec = {
} catch (e) {

}

let eids = [];
if (bidRequest && bidRequest.userId) {
bindUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1);
dmxRequest.user = dmxRequest.user || {};
dmxRequest.user.ext = dmxRequest.user.ext || {};
dmxRequest.user.ext.eids = eids;
}
if (!dmxRequest.test) {
delete dmxRequest.test;
}
Expand All @@ -91,6 +100,8 @@ export const spec = {
dmxRequest.user.ext = {};
dmxRequest.user.ext.consent = bidderRequest.gdprConsent.consentString;
}
dmxRequest.regs = dmxRequest.regs || {};
dmxRequest.regs.coppa = config.getConfig('coppa') === true ? 1 : 0;
if (bidderRequest && bidderRequest.uspConsent) {
dmxRequest.regs = dmxRequest.regs || {};
dmxRequest.regs.ext = dmxRequest.regs.ext || {};
Expand Down Expand Up @@ -281,4 +292,18 @@ export function defaultSize(thebidObj) {
returnObject.height = checkDeepArray(sizes)[1];
return returnObject;
}

export function bindUserId(eids, value, source, atype) {
if (utils.isStr(value) && Array.isArray(eids)) {
eids.push({
source,
uids: [
{
id: value,
atype
}
]
})
}
}
registerBidder(spec);
29 changes: 27 additions & 2 deletions modules/districtmDmxBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The `districtmDmxAdapter` module allows publishers to include DMX Exchange deman
* Single Request
* Multi-Size Support
* GDPR Compliant
* CCPA Compliant
* COPPA Compliant
* Bids returned in **NET**

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

| Key | Scope | Type | Description
| --- | --- | --- | ---
| dmxid | Mandatory | Integer | Unique identifier of the placement, dmxid can be obtained in the district m Boost platform.
| memberid | Mandatory | Integer | Unique identifier for your account, memberid can be obtained in the district m Boost platform.
| `dmxid` | Mandatory | Integer | Unique identifier of the placement, dmxid can be obtained in the district m Boost platform.
| `memberid` | Mandatory | Integer | Unique identifier for your account, memberid can be obtained in the district m Boost platform.
| `coppa` | optional | Boolean | Enables Child's Online Privacy Protection Act (COPPA) regulations. | true
stevealliance marked this conversation as resolved.
Show resolved Hide resolved


# Ad Unit Configuration Example

Expand All @@ -47,6 +51,27 @@ The `districtmDmxAdapter` module allows publishers to include DMX Exchange deman
```


# Ad Unit Configuration when COPPA is needed

```javascript
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]],
}
},
bids: [{
bidder: 'districtmDMX',
params: {
dmxid: 100001,
memberid: 100003,
coppa: 1
stevealliance marked this conversation as resolved.
Show resolved Hide resolved
}
}]
}];
```

# Quick Start Guide

###### 1. Including the `districtmDmxAdapter` in your build process.
Expand Down
57 changes: 55 additions & 2 deletions test/spec/modules/districtmDmxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const bidRequest = [{
'bidder': 'districtmDMX',
'params': {
'dmxid': 100001,
'memberid': 100003
'memberid': 100003,
},
'adUnitCode': 'div-gpt-ad-12345678-1',
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
Expand All @@ -53,6 +53,22 @@ const bidRequest = [{
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
}];

const bidRequestNoCoppa = [{
'bidder': 'districtmDMX',
'params': {
'dmxid': 100001,
'memberid': 100003
},
'adUnitCode': 'div-gpt-ad-12345678-1',
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
'sizes': [
[300, 250],
[300, 600]
],
'bidId': '29a28a1bbc8a8d',
'bidderRequestId': '124b579a136515',
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
}];
const bidderRequest = {
'bidderCode': 'districtmDMX',
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf',
Expand All @@ -61,7 +77,7 @@ const bidderRequest = {
'bidder': 'districtmDMX',
'params': {
'dmxid': 100001,
'memberid': 100003
'memberid': 100003,
},
'adUnitCode': 'div-gpt-ad-12345678-1',
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
Expand Down Expand Up @@ -420,6 +436,32 @@ const bidderRequest = {
'doneCbCallCount': 0
};

const bidderRequestNoCoppa = {
'bidderCode': 'districtmDMX',
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf',
'bidderRequestId': '124b579a136515',
'bids': [{
'bidder': 'districtmDMX',
'params': {
'dmxid': 100001,
'memberid': 100003,
},
'adUnitCode': 'div-gpt-ad-12345678-1',
'transactionId': 'f6d13fa6-ebc1-41ac-9afa-d8171d22d2c2',
'sizes': [
[300, 250],
[300, 600]
],
'bidId': '29a28a1bbc8a8d',
'bidderRequestId': '124b579a136515',
'auctionId': '3d62f2d3-56a2-4991-888e-f7754619ddcf'
}],
'auctionStart': 1529511035677,
'timeout': 700,
'start': 1529511035686,
'doneCbCallCount': 0
};

const responses = {
'body': {
'id': '1f45b37c-5298-4934-b517-4d911aadabfd',
Expand Down Expand Up @@ -522,6 +564,7 @@ describe('DistrictM Adaptor', function () {

describe(`buildRequests test usage`, function () {
const buildRequestResults = districtm.buildRequests(bidRequest, bidderRequest);
const buildRequestResultsNoCoppa = districtm.buildRequests(bidRequestNoCoppa, bidderRequestNoCoppa);
it(`the function should return an array`, function () {
expect(buildRequestResults).to.be.an('object');
});
Expand All @@ -531,6 +574,16 @@ describe('DistrictM Adaptor', function () {
expect(bidr.regs.ext.us_privacy).to.be.equal('1NY');
expect(bidr.user.ext.consent).to.be.an('string');
});
it(`test contain COPPA`, function() {
const bidr = JSON.parse(buildRequestResults.data)
bidr.regs = bidr.regs || {};
bidr.regs.coppa = 1;
expect(bidr.regs.coppa).to.be.equal(1)
})
it(`test should not contain COPPA`, function() {
const bidr = JSON.parse(buildRequestResultsNoCoppa.data)
expect(bidr.regs.coppa).to.be.equal(0)
})
it(`the function should return array length of 1`, function () {
expect(buildRequestResults.data).to.be.a('string');
});
Expand Down