Skip to content

Commit

Permalink
Connatix Bid Adapter : support eids (#12142)
Browse files Browse the repository at this point in the history
* add eids on request

* change naming

---------

Co-authored-by: Darian Avasan <[email protected]>
Co-authored-by: Octavia Suceava <[email protected]>
  • Loading branch information
3 people authored Aug 21, 2024
1 parent 8fe3e53 commit 95c8118
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
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 @@ -127,6 +138,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 @@ -352,6 +352,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

0 comments on commit 95c8118

Please sign in to comment.