Skip to content

Commit

Permalink
rubicon: adding pubcid support (#5824)
Browse files Browse the repository at this point in the history
* rubicon: adding pubcid support

* adding to orderedParams

* removed eids filter so all eids will be supported

* fix eids test

* fixed eids assertions

Co-authored-by: Isaac A. Dettman <[email protected]>
  • Loading branch information
bretg and Isaac A. Dettman authored Oct 6, 2020
1 parent ea498f9 commit 8982e09
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
11 changes: 9 additions & 2 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ export const spec = {

const eids = utils.deepAccess(bidderRequest, 'bids.0.userIdAsEids');
if (eids && eids.length) {
// filter out unsupported id systems
utils.deepSetValue(data, 'user.ext.eids', eids.filter(eid => ['adserver.org', 'pubcid.org', 'liveintent.com', 'liveramp.com', 'sharedid.org', 'criteo.com'].indexOf(eid.source) !== -1));
utils.deepSetValue(data, 'user.ext.eids', eids);

// liveintent requires additional props to be set
const liveIntentEid = find(data.user.ext.eids, eid => eid.source === 'liveintent.com');
Expand Down Expand Up @@ -389,6 +388,10 @@ export const spec = {
'tpid_tdid',
'tpid_liveintent.com',
'tg_v.LIseg',
'ppuid',
'eid_pubcid.org',
'eid_sharedid.org',
'eid_criteo.com',
'rf',
'p_geo.latitude',
'p_geo.longitude',
Expand Down Expand Up @@ -519,6 +522,10 @@ export const spec = {
if (sharedId) {
data['eid_sharedid.org'] = `${sharedId.uids[0].id}^${sharedId.uids[0].atype}^${sharedId.uids[0].ext.third}`;
}
const pubcid = find(bidRequest.userIdAsEids, eid => eid.source === 'pubcid.org');
if (pubcid) {
data['eid_pubcid.org'] = `${pubcid.uids[0].id}^${pubcid.uids[0].atype}`;
}
const criteoId = find(bidRequest.userIdAsEids, eid => eid.source === 'criteo.com');
if (criteoId) {
data['eid_criteo.com'] = `${criteoId.uids[0].id}^${criteoId.uids[0].atype}`;
Expand Down
26 changes: 23 additions & 3 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,20 @@ describe('the rubicon adapter', function () {
});
});

describe('pubcid support', function () {
it('should send eid_pubcid.org when userIdAsEids contains pubcid', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
pubcid: '1111'
};
clonedBid.userIdAsEids = createEidsArray(clonedBid.userId);
let [request] = spec.buildRequests([clonedBid], bidderRequest);
let data = parseQuery(request.data);

expect(data['eid_pubcid.org']).to.equal('1111^1');
});
});

describe('Criteo support', function () {
it('should send eid_criteo.com when userIdAsEids contains criteo', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
Expand Down Expand Up @@ -1442,10 +1456,16 @@ describe('the rubicon adapter', function () {
expect(post.user.ext.eids[4].source).to.equal('pubcid.org');
expect(post.user.ext.eids[4].uids[0].atype).to.equal(1);
expect(post.user.ext.eids[4].uids[0].id).to.equal('4000');
// example should exist
expect(post.user.ext.eids[5].source).to.equal('example.com');
expect(post.user.ext.eids[5].uids[0].id).to.equal('333333');
// id-partner.com
expect(post.user.ext.eids[6].source).to.equal('id-partner.com');
expect(post.user.ext.eids[6].uids[0].id).to.equal('4444444');
// CriteoId should exist
expect(post.user.ext.eids[5].source).to.equal('criteo.com');
expect(post.user.ext.eids[5].uids[0].id).to.equal('1111');
expect(post.user.ext.eids[5].uids[0].atype).to.equal(1);
expect(post.user.ext.eids[7].source).to.equal('criteo.com');
expect(post.user.ext.eids[7].uids[0].id).to.equal('1111');
expect(post.user.ext.eids[7].uids[0].atype).to.equal(1);

expect(post.regs.ext.gdpr).to.equal(1);
expect(post.regs.ext.us_privacy).to.equal('1NYN');
Expand Down

0 comments on commit 8982e09

Please sign in to comment.