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

Connatix Bid Adapter : support eids #12142

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 14 additions & 1 deletion modules/connatixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
isFn,
logError,
isArray,
formatQS
formatQS,
deepSetValue
} from '../src/utils.js';

import {
Expand Down Expand Up @@ -61,6 +62,16 @@ export function validateVideo(mediaTypes) {
return video.context !== ADPOD;
}

/**
* Get ids from Prebid User ID Modules and add them to the payload
*/
function _handleEids(payload, validBidRequests) {
let bidUserIdAsEids = deepAccess(validBidRequests, '0.userIdAsEids');
if (isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
deepSetValue(payload, 'userIdList', bidUserIdAsEids);
}
}

export const spec = {
code: BIDDER_CODE,
gvlid: 143,
Expand Down Expand Up @@ -130,6 +141,8 @@ export const spec = {
bidRequests,
};

_handleEids(requestPayload, validBidRequests);

return {
method: 'POST',
url: AD_URL,
Expand Down
32 changes: 32 additions & 0 deletions test/spec/modules/connatixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,38 @@ describe('connatixBidAdapter', function () {
});
});

describe('userIdAsEids', function() {
let validBidRequests;

this.beforeEach(function () {
bid = mockBidRequest();
validBidRequests = [bid];
})

it('Connatix adapter reads EIDs from Prebid user models and adds it to Request', function() {
validBidRequests[0].userIdAsEids = [{
'source': 'adserver.org',
'uids': [{
'id': 'TTD_ID_FROM_USER_ID_MODULE',
'atype': 1,
'ext': {
'stype': 'ppuid',
'rtiPartner': 'TDID'
}
}]
},
{
'source': 'pubserver.org',
'uids': [{
'id': 'TDID_FROM_USER_ID_MODULE',
'atype': 1
}]
}];
let serverRequest = spec.buildRequests(validBidRequests, {});
expect(serverRequest.data.userIdList).to.deep.equal(validBidRequests[0].userIdAsEids);
});
});

describe('getBidFloor', function () {
this.beforeEach(function () {
bid = mockBidRequest();
Expand Down