Skip to content

Commit

Permalink
PrebidServerbidAdapter to use userIdAsEids to set eids in request (pr…
Browse files Browse the repository at this point in the history
…ebid#4966)

* added support for pubcommon, digitrust, id5id

* added support for IdentityLink

* changed the source for id5

* added unit test cases

* changed source param for identityLink

* in-dev; breaking; waiting for a fix

* removed console.log

* deleted commented code
  • Loading branch information
pm-harshad-mane authored and rjvelicaria committed Apr 9, 2020
1 parent ac196f4 commit 20e8e51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 94 deletions.
97 changes: 3 additions & 94 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,100 +588,9 @@ const OPEN_RTB_PROTOCOL = {
request.ext.prebid.aliases = aliases;
}

const bidUserId = utils.deepAccess(bidRequests, '0.bids.0.userId');
if (bidUserId && typeof bidUserId === 'object' && (bidUserId.tdid || bidUserId.pubcid || bidUserId.parrableid || bidUserId.lipb || bidUserId.id5id || bidUserId.criteoId || bidUserId.britepoolid || bidUserId.idl_env)) {
utils.deepSetValue(request, 'user.ext.eids', []);

if (bidUserId.tdid) {
request.user.ext.eids.push({
source: 'adserver.org',
uids: [{
id: bidUserId.tdid,
ext: {
rtiPartner: 'TDID'
}
}]
});
}

if (bidUserId.pubcid) {
request.user.ext.eids.push({
source: 'pubcid.org',
uids: [{
id: bidUserId.pubcid,
}]
});
}

if (bidUserId.parrableid) {
request.user.ext.eids.push({
source: 'parrable.com',
uids: [{
id: bidUserId.parrableid
}]
});
}

if (bidUserId.lipb && bidUserId.lipb.lipbid) {
const liveIntent = {
source: 'liveintent.com',
uids: [{
id: bidUserId.lipb.lipbid
}]
};

if (Array.isArray(bidUserId.lipb.segments) && bidUserId.lipb.segments.length) {
liveIntent.ext = {
segments: bidUserId.lipb.segments
};
}
request.user.ext.eids.push(liveIntent);
}

if (bidUserId.id5id) {
request.user.ext.eids.push({
source: 'id5-sync.com',
uids: [{
id: bidUserId.id5id,
}]
});
}

if (bidUserId.criteoId) {
request.user.ext.eids.push({
source: 'criteo.com',
uids: [{
id: bidUserId.criteoId
}]
});
}

if (bidUserId.britepoolid) {
request.user.ext.eids.push({
source: 'britepool.com',
uids: [{
id: bidUserId.britepoolid
}]
});
}

if (bidUserId.idl_env) {
request.user.ext.eids.push({
source: 'liveramp.com',
uids: [{
id: bidUserId.idl_env
}]
})
}

if (bidUserId.netId) {
request.user.ext.eids.push({
source: 'netid.de',
uids: [{
id: bidUserId.netId
}]
})
}
const bidUserIdAsEids = utils.deepAccess(bidRequests, '0.bids.0.userIdAsEids');
if (utils.isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
utils.deepSetValue(request, 'user.ext.eids', bidUserIdAsEids);
}

if (bidRequests) {
Expand Down
2 changes: 2 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { config } from 'src/config.js';
import events from 'src/events.js';
import CONSTANTS from 'src/constants.json';
import { server } from 'test/mocks/xhr.js';
import { createEidsArray } from 'modules/userId/eids.js';

let CONFIG = {
accountId: '1',
Expand Down Expand Up @@ -1085,6 +1086,7 @@ describe('S2S Adapter', function () {
},
idl_env: '0000-1111-2222-3333'
};
userIdBidRequest[0].bids[0].userIdAsEids = createEidsArray(userIdBidRequest[0].bids[0].userId);

adapter.callBids(REQUEST, userIdBidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);
Expand Down

0 comments on commit 20e8e51

Please sign in to comment.