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

RubiconBidAdapter: CCPA (USP) Support #4530

Merged
merged 50 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8d635ff
Add microadBidAdapter
Feb 15, 2019
3055b90
Remove unnecessary encodeURIComponent from microadBidAdapter
Feb 26, 2019
67fb91b
Submit Advangelists Prebid Adapter
Feb 26, 2019
3ebb916
Submit Advangelists Prebid Adapter 1.1
Feb 27, 2019
4f5c451
Correct procudtion endpoint for prebid
Feb 28, 2019
2dc6d1d
Merge branch 'microad-bid-adapter' of git://github.com/strong-zero/Pr…
Feb 28, 2019
fa3e081
Merge remote-tracking branch 'origin/master' into master-rubicon-clean
Mar 18, 2019
600a46e
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Mar 18, 2019
7f578b3
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 23, 2019
176a312
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 26, 2019
9abf89c
Merge branch 'master' of https://github.com/prebid/Prebid.js
May 13, 2019
6ce04ab
Merge remote-tracking branch 'upstream/master'
Jun 10, 2019
415e2f6
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jun 27, 2019
61fb82c
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 11, 2019
3cc4c67
analytics update with wrapper name
Jul 11, 2019
cd81e02
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 15, 2019
e2b4e04
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 15, 2019
53b5970
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 15, 2019
5c00ed5
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 16, 2019
28848ad
reverted error merge
Jul 16, 2019
ab635ee
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 19, 2019
93308f5
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 24, 2019
1cfd52d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jul 25, 2019
d619807
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jul 27, 2019
9893f0f
Merge branch 'master' of https://github.com/prebid/Prebid.js
Aug 7, 2019
986a251
Merge remote-tracking branch 'upstream/master'
Aug 23, 2019
2cae7c0
Merge branch 'master' of https://github.com/prebid/Prebid.js into ori…
Aug 27, 2019
d7fd252
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 4, 2019
c7c01ba
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 10, 2019
24a28aa
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 10, 2019
7a1a4ec
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Sep 25, 2019
4173d16
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 25, 2019
ca13952
update changed default value of netRevenue to true
Sep 27, 2019
0b6cd48
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 3, 2019
5f0110d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 3, 2019
f930a34
Merge remote-tracking branch 'upstream/master'
Oct 8, 2019
9bff282
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 14, 2019
712ec9e
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 29, 2019
f192f65
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 29, 2019
006f53c
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 29, 2019
0341150
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 31, 2019
fa59897
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 15, 2019
dcff2cf
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 20, 2019
0222ce2
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 24, 2019
227beca
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 25, 2019
dc3ee49
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Dec 4, 2019
9a5a08d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Dec 4, 2019
ccf3b93
Add support for CCPA to Rubicon Bid Adapter
Dec 4, 2019
395827f
Update test names
Dec 4, 2019
5843fcf
Encode us_privacy string on GET requests
Dec 4, 2019
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
26 changes: 15 additions & 11 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,14 @@ export const spec = {
gdprApplies = bidderRequest.gdprConsent.gdprApplies ? 1 : 0;
}

if (data.regs) {
if (data.regs.ext) {
data.regs.ext.gdpr = gdprApplies;
} else {
data.regs.ext = {gdpr: gdprApplies};
}
} else {
data.regs = {ext: {gdpr: gdprApplies}};
}

utils.deepSetValue(data, 'regs.ext.gdpr', gdprApplies);
utils.deepSetValue(data, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
}

if (bidderRequest.uspConsent) {
utils.deepSetValue(data, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}

if (bidRequest.userId && typeof bidRequest.userId === 'object' &&
(bidRequest.userId.tdid || bidRequest.userId.pubcid || bidRequest.userId.lipb)) {
utils.deepSetValue(data, 'user.ext.eids', []);
Expand Down Expand Up @@ -344,6 +339,7 @@ export const spec = {
'p_pos',
'gdpr',
'gdpr_consent',
'us_privacy',
'rp_schain',
'tpid_tdid',
'tpid_liveintent.com',
Expand Down Expand Up @@ -471,6 +467,10 @@ export const spec = {
data['gdpr_consent'] = bidderRequest.gdprConsent.consentString;
}

if (bidderRequest.uspConsent) {
data['us_privacy'] = encodeURIComponent(bidderRequest.uspConsent);
}

// visitor properties
if (params.visitor !== null && typeof params.visitor === 'object') {
Object.keys(params.visitor).forEach((key) => {
Expand Down Expand Up @@ -680,7 +680,7 @@ export const spec = {
return (adB.cpm || 0.0) - (adA.cpm || 0.0);
});
},
getUserSyncs: function (syncOptions, responses, gdprConsent) {
getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
if (!hasSynced && syncOptions.iframeEnabled) {
// data is only assigned if params are available to pass to SYNC_ENDPOINT
let params = '';
Expand All @@ -694,6 +694,10 @@ export const spec = {
}
}

if (uspConsent) {
params += `${params ? '&' : '?'}us_privacy=${encodeURIComponent(uspConsent)}`;
}

hasSynced = true;
return {
type: 'iframe',
Expand Down
37 changes: 37 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,13 @@ describe('the rubicon adapter', function () {
}
}

function createUspBidderRequest() {
bidderRequest.uspConsent = '1NYN';
}

function createVideoBidderRequest() {
createGdprBidderRequest(true);
createUspBidderRequest();

let bid = bidderRequest.bids[0];
bid.mediaTypes = {
Expand Down Expand Up @@ -893,6 +898,23 @@ describe('the rubicon adapter', function () {
});
});

describe('USP Consent', function () {
it('should send us_privacy if bidderRequest has a value for uspConsent', function () {
createUspBidderRequest();
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

expect(data['us_privacy']).to.equal('1NYN');
});

it('should not send us_privacy if bidderRequest has no uspConsent value', function () {
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

expect(data['us_privacy']).to.equal(undefined);
});
});

describe('first party data', function () {
it('should not have any tg_v or tg_i params if all are undefined', function () {
let params = {
Expand Down Expand Up @@ -1285,6 +1307,7 @@ describe('the rubicon adapter', function () {
expect(post.rp.target.LIseg[0]).to.equal('segA');
expect(post.rp.target.LIseg[1]).to.equal('segB');
expect(post.regs.ext.gdpr).to.equal(1);
expect(post.regs.ext.us_privacy).to.equal('1NYN');
expect(post).to.have.property('ext').that.is.an('object');
expect(post.ext.prebid.targeting.includewinners).to.equal(true);
expect(post.ext.prebid).to.have.property('cache').that.is.an('object')
Expand Down Expand Up @@ -2302,6 +2325,20 @@ describe('the rubicon adapter', function () {
type: 'iframe', url: `${emilyUrl}`
});
});

it('should pass us_privacy if uspConsent is defined', function () {
expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, '1NYN')).to.deep.equal({
type: 'iframe', url: `${emilyUrl}?us_privacy=1NYN`
});
});

it('should pass us_privacy after gdpr if both are present', function () {
expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {
consentString: 'foo'
}, '1NYN')).to.deep.equal({
type: 'iframe', url: `${emilyUrl}?gdpr_consent=foo&us_privacy=1NYN`
});
});
});

describe('get price granularity', function() {
Expand Down