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

Platformio Adapter GDPR support #2787

Merged
merged 65 commits into from
Jul 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2cc71fb
Add PlatformioBidAdapter
varashellov Aug 1, 2017
6801ca1
Update platformioBidAdapter.js
varashellov Aug 2, 2017
9bdcd7e
Add files via upload
varashellov Aug 2, 2017
06c04ce
Update hello_world.html
varashellov Aug 2, 2017
3e11a2a
Update platformioBidAdapter.js
varashellov Aug 2, 2017
e3d049e
Update platformioBidAdapter_spec.js
varashellov Aug 2, 2017
c09d8ae
Update hello_world.html
varashellov Aug 2, 2017
e0be49c
Update platformioBidAdapter_spec.js
varashellov Aug 7, 2017
eedbd3e
Update platformioBidAdapter.js
varashellov Aug 14, 2017
faa9963
Update hello_world.html
varashellov Aug 14, 2017
946d081
Add files via upload
varashellov Aug 14, 2017
69b4f57
Update platformioBidAdapter
varashellov Aug 16, 2017
659562a
Update platformioBidAdapter
varashellov Aug 16, 2017
66a3f7f
Update platformioBidAdapter
varashellov Aug 16, 2017
225b798
Merge pull request #1 from varashellov/varashellov-patch-1
varashellov Aug 16, 2017
cd21b96
Add files via upload
varashellov Oct 17, 2017
e426d54
Add files via upload
varashellov Oct 17, 2017
4ac6786
Add files via upload
varashellov Oct 17, 2017
6cc3ec1
Merge branch 'master' into master
varashellov Oct 18, 2017
ccdfd49
Update platformioBidAdapter.js
varashellov Oct 19, 2017
3947c83
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
6451e5b
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
9282871
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
7b60d11
Update platformioBidAdapter.js
varashellov Oct 19, 2017
1124da8
Update platformioBidAdapter.js
varashellov Oct 19, 2017
176c633
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
96245d6
Add files via upload
varashellov Oct 20, 2017
380be34
Add files via upload
varashellov Oct 20, 2017
ffcfb29
Add files via upload
varashellov Oct 20, 2017
6d9cff3
Add files via upload
varashellov Nov 9, 2017
8ea886d
Add files via upload
varashellov Nov 9, 2017
0896c99
Add files via upload
varashellov Nov 9, 2017
764034a
Merge branch 'master' into master
varashellov Nov 9, 2017
af7b0c4
Update platformioBidAdapter.js
varashellov Nov 13, 2017
c1c9a48
Update platformioBidAdapter_spec.js
varashellov Nov 13, 2017
8da6491
Add files via upload
varashellov Jan 3, 2018
fa0d7b5
Add files via upload
varashellov Jan 3, 2018
dd6b0ef
Merge branch 'master' into master
varashellov Jan 3, 2018
ea0a5a0
Merge branch 'master' into master
varashellov Jan 3, 2018
02d65be
Add files via upload
varashellov Mar 7, 2018
8c279c0
Add files via upload
varashellov Mar 7, 2018
2ee61f6
Merge branch 'master' into master
varashellov Mar 7, 2018
b45d144
Update platformioBidAdapter_spec.js
varashellov Mar 7, 2018
d78f613
Update platformioBidAdapter.js
varashellov Mar 7, 2018
0bd73d1
Update platformioBidAdapter.md
varashellov Mar 10, 2018
c3cb234
Add files via upload
varashellov Mar 26, 2018
1dd1462
Add files via upload
varashellov Mar 26, 2018
f0eb8ac
Add files via upload
varashellov Mar 26, 2018
110384f
Merge branch 'master' into master
varashellov Mar 26, 2018
445ff71
Update platformioBidAdapter.md
varashellov Mar 28, 2018
70b7193
Update platformioBidAdapter.md
varashellov Mar 28, 2018
3bf9cbc
Update platformioBidAdapter.js
varashellov Mar 28, 2018
d61713c
Update platformioBidAdapter_spec.js
varashellov Mar 28, 2018
36b8d65
Update platformioBidAdapter.md
varashellov Mar 28, 2018
6653030
Add files via upload
varashellov Mar 28, 2018
6e4a678
Add files via upload
varashellov Mar 28, 2018
795381b
Delete hello_world.html
varashellov Mar 29, 2018
8eecd2d
Add files via upload
varashellov Mar 29, 2018
bc1cabc
Add files via upload
varashellov Apr 29, 2018
84e8163
Add files via upload
varashellov Apr 29, 2018
bbad3a2
Merge branch 'master' into master
varashellov Apr 29, 2018
d1327cb
Add files via upload
varashellov May 3, 2018
1190376
Add files via upload
varashellov Jun 28, 2018
95fd255
Add files via upload
varashellov Jun 28, 2018
cd1f3e5
Merge branch 'master' into master
varashellov Jun 28, 2018
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
10 changes: 9 additions & 1 deletion modules/platformioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const spec = {
isBidRequestValid: bid => (
!!(bid && bid.params && bid.params.pubId && bid.params.placementId)
),
buildRequests: bidRequests => {
buildRequests: (bidRequests, bidderRequest) => {
const request = {
id: bidRequests[0].bidderRequestId,
at: 2,
Expand All @@ -32,6 +32,7 @@ export const spec = {
app: app(bidRequests),
device: device(bidRequests),
};
applyGdpr(bidderRequest, request);
return {
method: 'POST',
url: '//piohbdisp.hb.adx1.com/',
Expand Down Expand Up @@ -276,6 +277,13 @@ function parse(rawResponse) {
return null;
}

function applyGdpr(bidderRequest, ortbRequest) {
if (bidderRequest && bidderRequest.gdprConsent) {
ortbRequest.regs = { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies ? 1 : 0 } };
ortbRequest.user = { ext: { consent: bidderRequest.gdprConsent.consentString } };
}
}

function nativeResponse(imp, bid) {
if (imp['native']) {
const nativeAd = parse(bid.adm);
Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/platformioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,23 @@ describe('Platform.io Adapter Tests', () => {
expect(ortbRequest.app.storeurl).to.equal('http://platform.io/apps');
expect(ortbRequest.app.domain).to.equal('platform.io');
});

it('Verify GDPR', () => {
const bidderRequest = {
gdprConsent: {
gdprApplies: true,
consentString: 'serialized_gpdr_data'
}
};
const request = spec.buildRequests(slotConfigs, bidderRequest);
expect(request.url).to.equal('//piohbdisp.hb.adx1.com/');
expect(request.method).to.equal('POST');
const ortbRequest = JSON.parse(request.data);
expect(ortbRequest.user).to.not.equal(null);
expect(ortbRequest.user.ext).to.not.equal(null);
expect(ortbRequest.user.ext.consent).to.equal('serialized_gpdr_data');
expect(ortbRequest.regs).to.not.equal(null);
expect(ortbRequest.regs.ext).to.not.equal(null);
expect(ortbRequest.regs.ext.gdpr).to.equal(1);
});
});