diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index e86d7022987..fe22915223e 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -359,56 +359,57 @@ function getUserIds(tdidAdapter, usp, gdpr, eids, gpp) { crbIDs: crb.syncIds || {} }; - // Pull Trade Desk ID from adapter - if (tdidAdapter) { - userIds.tdID = tdidAdapter; - } - - // Pull Trade Desk ID from our storage + // Pull Trade Desk ID if (!tdidAdapter && crb.tdID) { userIds.tdID = crb.tdID; + } else if (tdidAdapter) { + userIds.tdID = tdidAdapter; } + // USP if (usp) { userIds.usp = usp; } - try { - if (gdpr) { - userIds['gdpr'] = { - consent: gdpr.consentString || '', - applies: !!gdpr.gdprApplies, - } - } - } catch (e) { + // GDPR + if (gdpr) { + userIds.gdpr = { + consent: gdpr.consentString || '', + applies: !!gdpr.gdprApplies, + }; } + // Kargo ID if (crb.lexId != null) { userIds.kargoID = crb.lexId; } + // Client ID if (crb.clientId != null) { userIds.clientID = crb.clientId; } + // Opt Out if (crb.optOut != null) { userIds.optOut = crb.optOut; } + // User ID Sub-Modules (userIdAsEids) if (eids != null) { userIds.sharedIDEids = eids; } + // GPP if (gpp) { - const parsedGPP = {} - if (gpp && gpp.consentString) { - parsedGPP.gppString = gpp.consentString + const parsedGPP = {}; + if (gpp.consentString) { + parsedGPP.gppString = gpp.consentString; } - if (gpp && gpp.applicableSections) { - parsedGPP.applicableSections = gpp.applicableSections + if (gpp.applicableSections) { + parsedGPP.applicableSections = gpp.applicableSections; } if (!isEmpty(parsedGPP)) { - userIds.gpp = parsedGPP + userIds.gpp = parsedGPP; } } diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 20a43d0397f..eb8f310201d 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -112,6 +112,24 @@ describe('kargo adapter tests', function () { } } ] + }, + { + 'source': 'adquery.io', + 'uids': [ + { + 'id': 'adqueryId-123', + 'atype': 1 + } + ] + }, + { + 'source': 'criteo.com', + 'uids': [ + { + 'id': 'criteoId-456', + 'atype': 1 + } + ] } ], floorData: { @@ -582,6 +600,24 @@ describe('kargo adapter tests', function () { } } ] + }, + { + source: 'adquery.io', + uids: [ + { + id: 'adqueryId-123', + atype: 1 + } + ] + }, + { + source: 'criteo.com', + uids: [ + { + id: 'criteoId-456', + atype: 1 + } + ] } ], data: [