Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emx Digital Bid Adapter: support for liveramp id and uid2.0 #7133

Merged
merged 30 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e7cb062
adding ccpa support for emx_digital adapter
Dec 9, 2019
5c0cfc1
emx_digital ccpa compliance: lint fix
Dec 10, 2019
4c0a008
Merge branch 'master' of https://github.com/prebid/Prebid.js
Dec 17, 2019
676b419
emx 3.0 compliance update
Dec 17, 2019
36524b3
Merge branch 'master' of https://github.com/prebid/Prebid.js
ncolletti Jan 29, 2020
ec9f12f
Merge remote-tracking branch 'upstream/master'
Apr 22, 2020
9d96181
fix outstream renderer issue, update test spec
Apr 22, 2020
7a5fad2
sync with upstream
Apr 23, 2020
de685c9
Merge branch 'bug/EI-34'
Apr 23, 2020
b2d22a3
refactor formatVideoResponse function to use core-js/find
Apr 29, 2020
5b54a8c
Merge remote-tracking branch 'upstream/master'
DBogdanEMX Aug 15, 2020
29b8d20
Merge remote-tracking branch 'upstream/master'
Nov 9, 2020
aba7bb5
Merge remote-tracking branch 'upstream/master' into add_schain_forwar…
Nov 9, 2020
9be10ca
Add support for schain forwarding
Nov 9, 2020
080b2c7
Merge branch 'add_schain_forwarding'
Nov 9, 2020
09ec591
Merge remote-tracking branch 'upstream/master'
Nov 20, 2020
558a791
Resolved issue with Schain object location
Nov 20, 2020
734a72b
Merge remote-tracking branch 'upstream/master'
Dec 3, 2020
c33a070
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 Dec 15, 2020
6a06e18
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 Jan 19, 2021
b22ed51
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 May 10, 2021
9f235e7
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 May 11, 2021
ab197dc
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 May 12, 2021
fc0ab49
prebid 5.0 floor module and advertiserDomain support
rakeshbalakrishnan28 May 19, 2021
372e1bb
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 May 20, 2021
08dc8e2
Merge remote-tracking branch 'origin/prebid-5.0-support'
rakeshbalakrishnan28 May 20, 2021
6c943ef
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 Jun 21, 2021
993346e
liveramp idl and uid2.0 support for prebid
rakeshbalakrishnan28 Jun 24, 2021
5d71941
Merge remote-tracking branch 'upstream/master'
rakeshbalakrishnan28 Jul 1, 2021
f96690e
Merge pull request #2 from EMXDigital/liveramp_uid2_sidecar_support
EMXDigital Jul 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions modules/emx_digitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const RENDERER_URL = 'https://js.brealtime.com/outstream/1.30.0/bundle.js';
const ADAPTER_VERSION = '1.5.1';
const DEFAULT_CUR = 'USD';

const EIDS_SUPPORTED = [
{ key: 'idl_env', source: 'liveramp.com', rtiPartner: 'idl', queryParam: 'idl' },
{ key: 'uid2.id', source: 'uidapi.com', rtiPartner: 'UID2', queryParam: 'uid2' }
];

export const emxAdapter = {
validateSizes: (sizes) => {
if (!utils.isArray(sizes) || typeof sizes[0] === 'undefined') {
Expand Down Expand Up @@ -168,6 +173,27 @@ export const emxAdapter = {
}

return emxData;
},
// supporting eids
getEids(bidRequests) {
return EIDS_SUPPORTED
.map(emxAdapter.getUserId(bidRequests))
.filter(x => x);
},
getUserId(bidRequests) {
return ({ key, source, rtiPartner }) => {
let id = utils.deepAccess(bidRequests, `userId.${key}`);
return id ? emxAdapter.formatEid(id, source, rtiPartner) : null;
};
},
formatEid(id, source, rtiPartner) {
return {
source,
uids: [{
id,
ext: { rtiPartner }
}]
};
}
};

Expand Down Expand Up @@ -252,6 +278,21 @@ export const spec = {
if (bidderRequest && bidderRequest.uspConsent) {
emxData.us_privacy = bidderRequest.uspConsent
}

// adding eid support
if (bidderRequest.userId) {
let eids = emxAdapter.getEids(bidderRequest);
if (eids.length > 0) {
if (emxData.user && emxData.user.ext) {
emxData.user.ext.eids = eids;
} else {
emxData.user = {
ext: {eids}
};
}
}
}

return {
method: 'POST',
url,
Expand Down
34 changes: 34 additions & 0 deletions test/spec/modules/emx_digitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,40 @@ describe('emx_digital Adapter', function () {
expect(request.source.ext.schain).to.have.property('ver', '1.0');
expect(request.source.ext.schain.nodes[0].asi).to.equal(schainBidderRequest.bids[0].schain.nodes[0].asi);
});

it('should add liveramp identitylink id to request', () => {
const idl_env = '123';
const bidRequestWithID = utils.deepClone(bidderRequest);
bidRequestWithID.userId = { idl_env };
let requestWithID = spec.buildRequests(bidRequestWithID.bids, bidRequestWithID);
requestWithID = JSON.parse(requestWithID.data);
expect(requestWithID.user.ext.eids[0]).to.deep.equal({
source: 'liveramp.com',
uids: [{
id: idl_env,
ext: {
rtiPartner: 'idl'
}
}]
});
});

it('should add UID 2.0 to request', () => {
const uid2 = { id: '456' };
const bidRequestWithUID = utils.deepClone(bidderRequest);
bidRequestWithUID.userId = { uid2 };
let requestWithUID = spec.buildRequests(bidRequestWithUID.bids, bidRequestWithUID);
requestWithUID = JSON.parse(requestWithUID.data);
expect(requestWithUID.user.ext.eids[0]).to.deep.equal({
source: 'uidapi.com',
uids: [{
id: uid2.id,
ext: {
rtiPartner: 'UID2'
}
}]
});
});
});

describe('interpretResponse', function () {
Expand Down