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

TL-19844: removes duplicate eids from POST call #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
22 changes: 11 additions & 11 deletions modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ function _buildPostBody(bidRequests) {
});

let eids = [
...getUnifiedIdEids(bidRequests),
...getIdentityLinkEids(bidRequests),
...getCriteoEids(bidRequests)
...getUnifiedIdEids([bidRequests[0]]),
kzhouTL marked this conversation as resolved.
Show resolved Hide resolved
...getIdentityLinkEids([bidRequests[0]]),
...getCriteoEids([bidRequests[0]])
];

if (eids.length > 0) {
Expand Down Expand Up @@ -239,20 +239,20 @@ function _getExt(schain, fpd) {
return ext;
}

function getUnifiedIdEids(bidRequests) {
return getEids(bidRequests, 'tdid', 'adserver.org', 'TDID');
function getUnifiedIdEids(bidRequest) {
return getEids(bidRequest, 'tdid', 'adserver.org', 'TDID');
}

function getIdentityLinkEids(bidRequests) {
return getEids(bidRequests, 'idl_env', 'liveramp.com', 'idl');
function getIdentityLinkEids(bidRequest) {
return getEids(bidRequest, 'idl_env', 'liveramp.com', 'idl');
}

function getCriteoEids(bidRequests) {
return getEids(bidRequests, 'criteoId', 'criteo.com', 'criteoId');
function getCriteoEids(bidRequest) {
return getEids(bidRequest, 'criteoId', 'criteo.com', 'criteoId');
}

function getEids(bidRequests, type, source, rtiPartner) {
return bidRequests
function getEids(bidRequest, type, source, rtiPartner) {
return bidRequest
kzhouTL marked this conversation as resolved.
Show resolved Hide resolved
.map(getUserId(type)) // bids -> userIds of a certain type
.filter((x) => !!x) // filter out null userIds
.map(formatEid(source, rtiPartner)); // userIds -> eid objects
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ describe('triplelift adapter', function () {
const criteoId = '53e30ea700424f7bbdd793b02abc5d7';

const bidRequestsMultiple = [
{ ...bidRequests[0], userId: { tdid: tdidId } },
{ ...bidRequests[0], userId: { idl_env: idlEnvId } },
{ ...bidRequests[0], userId: { criteoId: criteoId } }
{ ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId } },
{ ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId } },
{ ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId } }
];

const request = tripleliftAdapterSpec.buildRequests(bidRequestsMultiple, bidderRequest);
Expand Down