From 8982e0904fde99454f4c10985ea46d019b683e5c Mon Sep 17 00:00:00 2001 From: bretg Date: Tue, 6 Oct 2020 15:08:39 -0400 Subject: [PATCH] rubicon: adding pubcid support (#5824) * 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 --- modules/rubiconBidAdapter.js | 11 +++++++-- test/spec/modules/rubiconBidAdapter_spec.js | 26 ++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/modules/rubiconBidAdapter.js b/modules/rubiconBidAdapter.js index a446cbc3ce0..d4411a82e8f 100644 --- a/modules/rubiconBidAdapter.js +++ b/modules/rubiconBidAdapter.js @@ -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'); @@ -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', @@ -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}`; diff --git a/test/spec/modules/rubiconBidAdapter_spec.js b/test/spec/modules/rubiconBidAdapter_spec.js index b2adc1f39ff..a38743d634a 100644 --- a/test/spec/modules/rubiconBidAdapter_spec.js +++ b/test/spec/modules/rubiconBidAdapter_spec.js @@ -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]); @@ -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');