Skip to content

Commit

Permalink
PulsePoint Bid Adapter: Support for first party eid data (#8215)
Browse files Browse the repository at this point in the history
* 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 #509

* ET-1765: Adding support for additional params in PulsePoint adapter (#2)

* ET-1850: Fixing #866

* Minor fix

* Adding mandatory parameters to Bid

* PulsePoint: Support for first party ids

* changing to getConfig

* Refactor to use pubProvidedId
  • Loading branch information
anand-venkatraman authored Apr 7, 2022
1 parent 5530dc1 commit b85ec2e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 126 deletions.
53 changes: 3 additions & 50 deletions modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
92 changes: 16 additions & 76 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [{
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit b85ec2e

Please sign in to comment.