From be8a581f75b698ec4b9f4517d13a5ba58dafceb5 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Mon, 8 Jun 2020 11:44:22 -0400 Subject: [PATCH 1/2] Add tradedesk id support --- modules/appnexusBidAdapter.js | 11 +++++++++++ test/spec/modules/appnexusBidAdapter_spec.js | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index 5e3b6a06011..5a9647a7863 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -199,6 +199,17 @@ export const spec = { payload.tpuids = tpuids; } + const tdid = utils.deepAccess(bidRequests[0], `userId.tdid`); + if (tdid) { + let eids = []; + eids.push({ + source: 'adserver.org', + id: tdid, + rti_partner: 'TDID' + }); + payload.eids = eids; + } + if (tags[0].publisher_id) { payload.publisher_id = tags[0].publisher_id; } diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index 7d6f9c6789c..283fa3407a6 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -819,6 +819,22 @@ describe('AppNexusAdapter', function () { const request = spec.buildRequests(bidRequests, bidderRequest); expect(request.options).to.deep.equal({withCredentials: false}); }); + + it('should populate eids array when ttd id is available', function () { + const bidRequest = Object.assign({}, bidRequests[0], { + userId: { + tdid: 'sample-userid' + } + }); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + expect(payload.eids).to.deep.equal([{ + source: 'adserver.org', + id: 'sample-userid', + rti_partner: 'TDID' + }]); + }); }) describe('interpretResponse', function () { From dd3a1c89f7f4794a7e5b99c35fea9db3a7413984 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Mon, 29 Jun 2020 17:39:27 -0400 Subject: [PATCH 2/2] Updating appnexus payload for criteo --- modules/appnexusBidAdapter.js | 13 +++++----- test/spec/modules/appnexusBidAdapter_spec.js | 26 ++++++++------------ 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index 5a9647a7863..3f58bcf917a 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -189,24 +189,25 @@ export const spec = { }); } + let eids = []; const criteoId = utils.deepAccess(bidRequests[0], `userId.criteoId`); if (criteoId) { - let tpuids = []; - tpuids.push({ - 'provider': 'criteo', - 'user_id': criteoId + eids.push({ + source: 'criteo.com', + id: criteoId }); - payload.tpuids = tpuids; } const tdid = utils.deepAccess(bidRequests[0], `userId.tdid`); if (tdid) { - let eids = []; eids.push({ source: 'adserver.org', id: tdid, rti_partner: 'TDID' }); + } + + if (eids.length) { payload.eids = eids; } diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index 283fa3407a6..52c4be9b94f 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -738,18 +738,6 @@ describe('AppNexusAdapter', function () { }); }); - it('should populate tpids array when userId is available', function () { - const bidRequest = Object.assign({}, bidRequests[0], { - userId: { - criteoId: 'sample-userid' - } - }); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - expect(payload.tpuids).to.deep.equal([{provider: 'criteo', user_id: 'sample-userid'}]); - }); - it('should populate schain if available', function () { const bidRequest = Object.assign({}, bidRequests[0], { schain: { @@ -820,20 +808,26 @@ describe('AppNexusAdapter', function () { expect(request.options).to.deep.equal({withCredentials: false}); }); - it('should populate eids array when ttd id is available', function () { + it('should populate eids array when ttd id and criteo is available', function () { const bidRequest = Object.assign({}, bidRequests[0], { userId: { - tdid: 'sample-userid' + tdid: 'sample-userid', + criteoId: 'sample-criteo-userid' } }); const request = spec.buildRequests([bidRequest]); const payload = JSON.parse(request.data); - expect(payload.eids).to.deep.equal([{ + expect(payload.eids).to.deep.include({ source: 'adserver.org', id: 'sample-userid', rti_partner: 'TDID' - }]); + }); + + expect(payload.eids).to.deep.include({ + source: 'criteo.com', + id: 'sample-criteo-userid', + }); }); })