Skip to content

Commit

Permalink
Yieldlift Bid Adapter: add support for eids (prebid#8707)
Browse files Browse the repository at this point in the history
* Added eids parameter

* Added eids parameter test

* Fixing utils

Co-authored-by: Danijel Predarski <[email protected]>
  • Loading branch information
yieldlift and dani-nova authored Jul 25, 2022
1 parent 599a8dd commit 37eabf5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/yieldliftBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepSetValue, logInfo, deepAccess } from '../src/utils.js';
import {deepSetValue, logInfo, deepAccess} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';

Expand Down Expand Up @@ -72,6 +72,12 @@ export const spec = {
deepSetValue(openrtbRequest, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}

// EIDS
const eids = deepAccess(validBidRequests[0], 'userIdAsEids');
if (Array.isArray(eids) && eids.length > 0) {
deepSetValue(openrtbRequest, 'user.ext.eids', eids);
}

const payloadString = JSON.stringify(openrtbRequest);
return {
method: 'POST',
Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/yieldliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,26 @@ describe('YieldLift', function () {
expect(payload.user.ext).to.have.property('consent', req.gdprConsent.consentString);
expect(payload.regs.ext).to.have.property('gdpr', 1);
});

it('should properly forward eids parameters', function () {
const req = Object.assign({}, REQUEST);
req.bidRequest[0].userIdAsEids = [
{
source: 'dummy.com',
uids: [
{
id: 'd6d0a86c-20c6-4410-a47b-5cba383a698a',
atype: 1
}
]
}];
let request = spec.buildRequests(req.bidRequest, req);

const payload = JSON.parse(request.data);
expect(payload.user.ext.eids[0].source).to.equal('dummy.com');
expect(payload.user.ext.eids[0].uids[0].id).to.equal('d6d0a86c-20c6-4410-a47b-5cba383a698a');
expect(payload.user.ext.eids[0].uids[0].atype).to.equal(1);
});
});

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

0 comments on commit 37eabf5

Please sign in to comment.