Skip to content

Commit

Permalink
Provide criteoId to server by user.ext.eids (prebid#4478)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwcmw authored and afewcc committed Dec 10, 2019
1 parent 83b6e8f commit 6452f88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ const OPEN_RTB_PROTOCOL = {
}

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

if (bidUserId.tdid) {
Expand Down Expand Up @@ -755,6 +755,15 @@ const OPEN_RTB_PROTOCOL = {
}]
});
}

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

if (bidRequests && bidRequests[0].gdprConsent) {
Expand Down
3 changes: 3 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ describe('S2S Adapter', function () {

let userIdBidRequest = utils.deepClone(BID_REQUESTS);
userIdBidRequest[0].bids[0].userId = {
criteoId: '44VmRDeUE3ZGJ5MzRkRVJHU3BIUlJ6TlFPQUFU',
tdid: 'abc123',
pubcid: '1234',
parrableid: '01.1563917337.test-eid',
Expand All @@ -1094,6 +1095,8 @@ describe('S2S Adapter', function () {
expect(Array.isArray(requestBid.user.ext.eids)).to.be.true;
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'adserver.org')).is.not.empty;
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'adserver.org')[0].uids[0].id).is.equal('abc123');
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'criteo.com')).is.not.empty;
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'criteo.com')[0].uids[0].id).is.equal('44VmRDeUE3ZGJ5MzRkRVJHU3BIUlJ6TlFPQUFU');
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'pubcommon')).is.not.empty;
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'pubcommon')[0].uids[0].id).is.equal('1234');
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'parrable.com')).is.not.empty;
Expand Down

0 comments on commit 6452f88

Please sign in to comment.