Skip to content

Commit

Permalink
Rubicon Bid Adapter: fix incorrect sharedid param (#5671)
Browse files Browse the repository at this point in the history
* Add microadBidAdapter

* Remove unnecessary encodeURIComponent from microadBidAdapter

* Submit Advangelists Prebid Adapter

* Submit Advangelists Prebid Adapter 1.1

* Correct procudtion endpoint for prebid

* analytics update with wrapper name

* reverted error merge

* update changed default value of netRevenue to true

* Re-add rubicon analytics without deprecated getTopWindowUrl util

* Cache referrer on auction_init instead of bid_requested

* merged remote master changes

* fix for rp adapter incorrect sharedid value

Co-authored-by: nakamoto <[email protected]>
Co-authored-by: Chandra Prakash <[email protected]>
Co-authored-by: Eric Harper <[email protected]>
Co-authored-by: TJ Eastmond <[email protected]>
Co-authored-by: Mark Monday <[email protected]>
Co-authored-by: msm0504 <[email protected]>
  • Loading branch information
7 people authored Aug 31, 2020
1 parent d642ebe commit c4c060e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
32 changes: 15 additions & 17 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,27 +516,25 @@ export const spec = {
// For SRA we need to explicitly put empty semi colons so AE treats it as empty, instead of copying the latter value
data['p_pos'] = (params.position === 'atf' || params.position === 'btf') ? params.position : '';

if (bidRequest.userId) {
if (bidRequest.userId.tdid) {
data['tpid_tdid'] = bidRequest.userId.tdid;
if (bidRequest.userIdAsEids && bidRequest.userIdAsEids.length) {
const unifiedId = find(bidRequest.userIdAsEids, eid => eid.source === 'adserver.org');
if (unifiedId) {
data['tpid_tdid'] = unifiedId.uids[0].id;
}

// support liveintent ID
if (bidRequest.userId.lipb && bidRequest.userId.lipb.lipbid) {
data['tpid_liveintent.com'] = bidRequest.userId.lipb.lipbid;
if (Array.isArray(bidRequest.userId.lipb.segments) && bidRequest.userId.lipb.segments.length) {
data['tg_v.LIseg'] = bidRequest.userId.lipb.segments.join(',');
const liveintentId = find(bidRequest.userIdAsEids, eid => eid.source === 'liveintent.com');
if (liveintentId) {
data['tpid_liveintent.com'] = liveintentId.uids[0].id;
if (liveintentId.ext && Array.isArray(liveintentId.ext.segments) && liveintentId.ext.segments.length) {
data['tg_v.LIseg'] = liveintentId.ext.segments.join(',');
}
}

// support identityLink (aka LiveRamp)
if (bidRequest.userId.idl_env) {
data['x_liverampidl'] = bidRequest.userId.idl_env;
const liverampId = find(bidRequest.userIdAsEids, eid => eid.source === 'liveramp.com');
if (liverampId) {
data['x_liverampidl'] = liverampId.uids[0].id;
}

// support shared id
if (bidRequest.userId.sharedid) {
data['eid_sharedid.org'] = `${bidRequest.userId.sharedid.id}^3^${bidRequest.userId.sharedid.third}`;
const sharedId = find(bidRequest.userIdAsEids, eid => eid.source === 'sharedid.org');
if (sharedId) {
data['eid_sharedid.org'] = `${sharedId.uids[0].id}^${sharedId.uids[0].atype}^${sharedId.uids[0].ext.third}`;
}
}

Expand Down
12 changes: 6 additions & 6 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ describe('the rubicon adapter', function () {
});

describe('user id config', function() {
it('should send tpid_tdid when userId defines tdid', function () {
it('should send tpid_tdid when userIdAsEids contains unifiedId', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
tdid: 'abcd-efgh-ijkl-mnop-1234'
Expand All @@ -1329,7 +1329,7 @@ describe('the rubicon adapter', function () {
});

describe('LiveIntent support', function () {
it('should send tpid_liveintent.com when userId defines lipd', function () {
it('should send tpid_liveintent.com when userIdAsEids contains liveintentId', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
lipb: {
Expand All @@ -1343,7 +1343,7 @@ describe('the rubicon adapter', function () {
expect(data['tpid_liveintent.com']).to.equal('0000-1111-2222-3333');
});

it('should send tg_v.LIseg when userId defines lipd.segments', function () {
it('should send tg_v.LIseg when userIdAsEids contains liveintentId with ext.segments as array', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
lipb: {
Expand All @@ -1361,7 +1361,7 @@ describe('the rubicon adapter', function () {
});

describe('LiveRamp support', function () {
it('should send x_liverampidl when userId defines idl_env', function () {
it('should send x_liverampidl when userIdAsEids contains liverampId', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
idl_env: '1111-2222-3333-4444'
Expand All @@ -1375,7 +1375,7 @@ describe('the rubicon adapter', function () {
});

describe('SharedID support', function () {
it('should send sharedid when userId defines sharedId', function () {
it('should send sharedid when userIdAsEids contains sharedId', function () {
const clonedBid = utils.deepClone(bidderRequest.bids[0]);
clonedBid.userId = {
sharedid: {
Expand All @@ -1387,7 +1387,7 @@ describe('the rubicon adapter', function () {
let [request] = spec.buildRequests([clonedBid], bidderRequest);
let data = parseQuery(request.data);

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

Expand Down

0 comments on commit c4c060e

Please sign in to comment.