Skip to content

Commit

Permalink
Module: appnexusBidAdapter. handle the case when userId is set, but u…
Browse files Browse the repository at this point in the history
…serIdAsEids not (prebid#12705)

* handle the case when userId is set, but userIdAsEids not

* fix linter errors

* fix remaining linter error
  • Loading branch information
olafbuitelaar authored Jan 30, 2025
1 parent a1e8b12 commit b33d77c
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,18 +354,23 @@ export const spec = {

if (bidRequests[0].userId) {
let eids = [];
bidRequests[0].userIdAsEids.forEach(eid => {
if (!eid || !eid.uids || eid.uids.length < 1) { return; }
eid.uids.forEach(uid => {
let tmp = {'source': eid.source, 'id': uid.id};
if (eid.source == 'adserver.org') {
tmp.rti_partner = 'TDID';
} else if (eid.source == 'uidapi.com') {
tmp.rti_partner = 'UID2';
}
eids.push(tmp);
const processEids = (uids) => {
uids.forEach(eid => {
if (!eid || !eid.uids || eid.uids.length < 1) { return; }
eid.uids.forEach(uid => {
let tmp = {'source': eid.source, 'id': uid.id};
if (eid.source == 'adserver.org') {
tmp.rti_partner = 'TDID';
} else if (eid.source == 'uidapi.com') {
tmp.rti_partner = 'UID2';
}
eids.push(tmp);
});
});
});
}
if (bidRequests[0].userIdAsEids) {
processEids(bidRequests[0].userIdAsEids);
}
if (eids.length) {
payload.eids = eids;
}
Expand Down

0 comments on commit b33d77c

Please sign in to comment.