From b33d77c856c2bbd7ee16df08c84c9c089368c0ec Mon Sep 17 00:00:00 2001 From: olafbuitelaar Date: Thu, 30 Jan 2025 18:37:23 +0100 Subject: [PATCH] Module: appnexusBidAdapter. handle the case when userId is set, but userIdAsEids not (#12705) * handle the case when userId is set, but userIdAsEids not * fix linter errors * fix remaining linter error --- modules/appnexusBidAdapter.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index 4270b47d91e..099dd989a1d 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -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; }