Skip to content

Commit 20e8e51

Browse files
pm-harshad-manerjvelicaria
authored andcommitted
PrebidServerbidAdapter to use userIdAsEids to set eids in request (prebid#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
1 parent ac196f4 commit 20e8e51

File tree

2 files changed

+5
-94
lines changed

2 files changed

+5
-94
lines changed

modules/prebidServerBidAdapter/index.js

+3-94
Original file line numberDiff line numberDiff line change
@@ -588,100 +588,9 @@ const OPEN_RTB_PROTOCOL = {
588588
request.ext.prebid.aliases = aliases;
589589
}
590590

591-
const bidUserId = utils.deepAccess(bidRequests, '0.bids.0.userId');
592-
if (bidUserId && typeof bidUserId === 'object' && (bidUserId.tdid || bidUserId.pubcid || bidUserId.parrableid || bidUserId.lipb || bidUserId.id5id || bidUserId.criteoId || bidUserId.britepoolid || bidUserId.idl_env)) {
593-
utils.deepSetValue(request, 'user.ext.eids', []);
594-
595-
if (bidUserId.tdid) {
596-
request.user.ext.eids.push({
597-
source: 'adserver.org',
598-
uids: [{
599-
id: bidUserId.tdid,
600-
ext: {
601-
rtiPartner: 'TDID'
602-
}
603-
}]
604-
});
605-
}
606-
607-
if (bidUserId.pubcid) {
608-
request.user.ext.eids.push({
609-
source: 'pubcid.org',
610-
uids: [{
611-
id: bidUserId.pubcid,
612-
}]
613-
});
614-
}
615-
616-
if (bidUserId.parrableid) {
617-
request.user.ext.eids.push({
618-
source: 'parrable.com',
619-
uids: [{
620-
id: bidUserId.parrableid
621-
}]
622-
});
623-
}
624-
625-
if (bidUserId.lipb && bidUserId.lipb.lipbid) {
626-
const liveIntent = {
627-
source: 'liveintent.com',
628-
uids: [{
629-
id: bidUserId.lipb.lipbid
630-
}]
631-
};
632-
633-
if (Array.isArray(bidUserId.lipb.segments) && bidUserId.lipb.segments.length) {
634-
liveIntent.ext = {
635-
segments: bidUserId.lipb.segments
636-
};
637-
}
638-
request.user.ext.eids.push(liveIntent);
639-
}
640-
641-
if (bidUserId.id5id) {
642-
request.user.ext.eids.push({
643-
source: 'id5-sync.com',
644-
uids: [{
645-
id: bidUserId.id5id,
646-
}]
647-
});
648-
}
649-
650-
if (bidUserId.criteoId) {
651-
request.user.ext.eids.push({
652-
source: 'criteo.com',
653-
uids: [{
654-
id: bidUserId.criteoId
655-
}]
656-
});
657-
}
658-
659-
if (bidUserId.britepoolid) {
660-
request.user.ext.eids.push({
661-
source: 'britepool.com',
662-
uids: [{
663-
id: bidUserId.britepoolid
664-
}]
665-
});
666-
}
667-
668-
if (bidUserId.idl_env) {
669-
request.user.ext.eids.push({
670-
source: 'liveramp.com',
671-
uids: [{
672-
id: bidUserId.idl_env
673-
}]
674-
})
675-
}
676-
677-
if (bidUserId.netId) {
678-
request.user.ext.eids.push({
679-
source: 'netid.de',
680-
uids: [{
681-
id: bidUserId.netId
682-
}]
683-
})
684-
}
591+
const bidUserIdAsEids = utils.deepAccess(bidRequests, '0.bids.0.userIdAsEids');
592+
if (utils.isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
593+
utils.deepSetValue(request, 'user.ext.eids', bidUserIdAsEids);
685594
}
686595

687596
if (bidRequests) {

test/spec/modules/prebidServerBidAdapter_spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { config } from 'src/config.js';
77
import events from 'src/events.js';
88
import CONSTANTS from 'src/constants.json';
99
import { server } from 'test/mocks/xhr.js';
10+
import { createEidsArray } from 'modules/userId/eids.js';
1011

1112
let CONFIG = {
1213
accountId: '1',
@@ -1085,6 +1086,7 @@ describe('S2S Adapter', function () {
10851086
},
10861087
idl_env: '0000-1111-2222-3333'
10871088
};
1089+
userIdBidRequest[0].bids[0].userIdAsEids = createEidsArray(userIdBidRequest[0].bids[0].userId);
10881090

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

0 commit comments

Comments
 (0)