From b85ec2e29c58a50b27bb0c273e90dfdff515cb87 Mon Sep 17 00:00:00 2001 From: Anand Venkatraman Date: Thu, 7 Apr 2022 13:53:10 -0400 Subject: [PATCH] PulsePoint Bid Adapter: Support for first party eid data (#8215) * ET-1691: Pulsepoint Analytics adapter for Prebid. (#1) * ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter * ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter * ET-1691: cleanup * ET-1691: minor * ET-1691: revert package.json change * Adding bidRequest to bidFactory.createBid method as per https://github.com/prebid/Prebid.js/issues/509 * ET-1765: Adding support for additional params in PulsePoint adapter (#2) * ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866 * Minor fix * Adding mandatory parameters to Bid * PulsePoint: Support for first party ids * changing to getConfig * Refactor to use pubProvidedId --- modules/pulsepointBidAdapter.js | 53 +---------- .../spec/modules/pulsepointBidAdapter_spec.js | 92 ++++--------------- 2 files changed, 19 insertions(+), 126 deletions(-) diff --git a/modules/pulsepointBidAdapter.js b/modules/pulsepointBidAdapter.js index 7aa3ad6088c..c0280e944ae 100644 --- a/modules/pulsepointBidAdapter.js +++ b/modules/pulsepointBidAdapter.js @@ -419,61 +419,14 @@ function user(bidRequest, bidderRequest) { } } if (bidRequest) { - if (bidRequest.userId) { - ext.eids = []; - addExternalUserId(ext.eids, bidRequest.userId.pubcid, 'pubcid.org'); - addExternalUserId(ext.eids, bidRequest.userId.britepoolid, 'britepool.com'); - addExternalUserId(ext.eids, bidRequest.userId.criteoId, 'criteo.com'); - addExternalUserId(ext.eids, bidRequest.userId.idl_env, 'liveramp.com'); - addExternalUserId(ext.eids, deepAccess(bidRequest, 'userId.id5id.uid'), 'id5-sync.com', deepAccess(bidRequest, 'userId.id5id.ext')); - addExternalUserId(ext.eids, deepAccess(bidRequest, 'userId.parrableId.eid'), 'parrable.com'); - addExternalUserId(ext.eids, bidRequest.userId.fabrickId, 'neustar.biz'); - addExternalUserId(ext.eids, deepAccess(bidRequest, 'userId.haloId.haloId'), 'audigent.com'); - addExternalUserId(ext.eids, bidRequest.userId.merkleId, 'merkleinc.com'); - addExternalUserId(ext.eids, bidRequest.userId.lotamePanoramaId, 'crwdcntrl.net'); - addExternalUserId(ext.eids, bidRequest.userId.connectid, 'verizonmedia.com'); - addExternalUserId(ext.eids, deepAccess(bidRequest, 'userId.uid2.id'), 'uidapi.com'); - // liveintent - if (bidRequest.userId.lipb && bidRequest.userId.lipb.lipbid) { - addExternalUserId(ext.eids, bidRequest.userId.lipb.lipbid, 'liveintent.com'); - } - // TTD - addExternalUserId(ext.eids, bidRequest.userId.tdid, 'adserver.org', { - rtiPartner: 'TDID' - }); - // digitrust - const digitrustResponse = bidRequest.userId.digitrustid; - if (digitrustResponse && digitrustResponse.data) { - var digitrust = {}; - if (digitrustResponse.data.id) { - digitrust.id = digitrustResponse.data.id; - } - if (digitrustResponse.data.keyv) { - digitrust.keyv = digitrustResponse.data.keyv; - } - ext.digitrust = digitrust; - } + let eids = bidRequest.userIdAsEids; + if (eids) { + ext.eids = eids; } } return { ext }; } -/** - * Produces external userid object in ortb 3.0 model. - */ -function addExternalUserId(eids, id, source, uidExt) { - if (id) { - var uid = { id }; - if (uidExt) { - uid.ext = uidExt; - } - eids.push({ - source, - uids: [ uid ] - }); - } -} - /** * Produces the regulations ortb object */ diff --git a/test/spec/modules/pulsepointBidAdapter_spec.js b/test/spec/modules/pulsepointBidAdapter_spec.js index 92f7aa0b70d..c8ec0493d54 100644 --- a/test/spec/modules/pulsepointBidAdapter_spec.js +++ b/test/spec/modules/pulsepointBidAdapter_spec.js @@ -2,6 +2,7 @@ import {expect} from 'chai'; import {spec} from 'modules/pulsepointBidAdapter.js'; import {deepClone} from 'src/utils.js'; +import { config } from 'src/config.js'; describe('PulsePoint Adapter Tests', function () { const slotConfigs = [{ @@ -615,70 +616,21 @@ describe('PulsePoint Adapter Tests', function () { }); it('Verify common id parameters', function () { const bidRequests = deepClone(slotConfigs); - bidRequests[0].userId = { - pubcid: 'userid_pubcid', - tdid: 'userid_ttd', - digitrustid: { - data: { - id: 'userid_digitrust', - keyv: 4, - privacy: {optout: false}, - producer: 'ABC', - version: 2 + bidRequests[0].userIdAsEids = [{ + source: 'pubcid.org', + uids: [{ + id: 'userid_pubcid' + }] + }, { + source: 'adserver.org', + uids: [{ + id: 'userid_ttd', + ext: { + rtiPartner: 'TDID' } - } - }; - const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request).to.be.not.null; - const ortbRequest = request.data; - expect(request.data).to.be.not.null; - // user object - expect(ortbRequest.user).to.not.be.undefined; - expect(ortbRequest.user.ext).to.not.be.undefined; - expect(ortbRequest.user.ext.eids).to.not.be.undefined; - expect(ortbRequest.user.ext.eids).to.have.lengthOf(2); - expect(ortbRequest.user.ext.eids[0].source).to.equal('pubcid.org'); - expect(ortbRequest.user.ext.eids[0].uids).to.have.lengthOf(1); - expect(ortbRequest.user.ext.eids[0].uids[0].id).to.equal('userid_pubcid'); - expect(ortbRequest.user.ext.eids[1].source).to.equal('adserver.org'); - expect(ortbRequest.user.ext.eids[1].uids).to.have.lengthOf(1); - expect(ortbRequest.user.ext.eids[1].uids[0].id).to.equal('userid_ttd'); - expect(ortbRequest.user.ext.eids[1].uids[0].ext).to.not.be.null; - expect(ortbRequest.user.ext.eids[1].uids[0].ext.rtiPartner).to.equal('TDID'); - expect(ortbRequest.user.ext.digitrust).to.not.be.null; - expect(ortbRequest.user.ext.digitrust.id).to.equal('userid_digitrust'); - expect(ortbRequest.user.ext.digitrust.keyv).to.equal(4); - }); - it('Verify new external user id partners', function () { - const bidRequests = deepClone(slotConfigs); - bidRequests[0].userId = { - britepoolid: 'britepool_id123', - criteoId: 'criteo_id234', - idl_env: 'idl_id123', - id5id: { uid: 'id5id_234' }, - parrableId: { eid: 'parrable_id234' }, - lipb: { - lipbid: 'liveintent_id123' - }, - haloId: { - haloId: 'halo_user1' - }, - lotamePanoramaId: 'lotame_user2', - merkleId: 'merkle_user3', - fabrickId: 'fabrick_user4', - connectid: 'connect_user5', - uid2: { - id: 'uid2_user6' - } - }; - const userVerify = function(obj, source, id) { - expect(obj).to.deep.equal({ - source, - uids: [{ - id - }] - }); - }; + }] + } + ]; const request = spec.buildRequests(bidRequests, bidderRequest); expect(request).to.be.not.null; const ortbRequest = request.data; @@ -687,19 +639,7 @@ describe('PulsePoint Adapter Tests', function () { expect(ortbRequest.user).to.not.be.undefined; expect(ortbRequest.user.ext).to.not.be.undefined; expect(ortbRequest.user.ext.eids).to.not.be.undefined; - expect(ortbRequest.user.ext.eids).to.have.lengthOf(12); - userVerify(ortbRequest.user.ext.eids[0], 'britepool.com', 'britepool_id123'); - userVerify(ortbRequest.user.ext.eids[1], 'criteo.com', 'criteo_id234'); - userVerify(ortbRequest.user.ext.eids[2], 'liveramp.com', 'idl_id123'); - userVerify(ortbRequest.user.ext.eids[3], 'id5-sync.com', 'id5id_234'); - userVerify(ortbRequest.user.ext.eids[4], 'parrable.com', 'parrable_id234'); - userVerify(ortbRequest.user.ext.eids[5], 'neustar.biz', 'fabrick_user4'); - userVerify(ortbRequest.user.ext.eids[6], 'audigent.com', 'halo_user1'); - userVerify(ortbRequest.user.ext.eids[7], 'merkleinc.com', 'merkle_user3'); - userVerify(ortbRequest.user.ext.eids[8], 'crwdcntrl.net', 'lotame_user2'); - userVerify(ortbRequest.user.ext.eids[9], 'verizonmedia.com', 'connect_user5'); - userVerify(ortbRequest.user.ext.eids[10], 'uidapi.com', 'uid2_user6'); - userVerify(ortbRequest.user.ext.eids[11], 'liveintent.com', 'liveintent_id123'); + expect(ortbRequest.user.ext.eids).to.deep.equal(bidRequests[0].userIdAsEids); }); it('Verify multiple adsizes', function () { const bidRequests = deepClone(slotConfigs);