Skip to content

Commit

Permalink
support for ID5 (prebid#8712)
Browse files Browse the repository at this point in the history
  • Loading branch information
haruka-yamashita2 authored and jorgeluisrocha committed May 18, 2023
1 parent 2f06b8e commit eb8cc71
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/yieldoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export const spec = {
payload.fuuid = dacId;
}

// ID5
const id5id = deepAccess(bidRequest, 'userId.id5id.uid');
if (isStr(id5id) && !isEmpty(id5id)) {
payload.id5Id = id5id;
}

return {
method: 'GET',
url: ENDPOINT_URL,
Expand Down
33 changes: 33 additions & 0 deletions test/spec/modules/yieldoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,39 @@ describe('yieldoneBidAdapter', function() {
expect(request[0].data.fuuid).to.equal('dacId_sample');
});
});

describe('ID5', function () {
it('dont send ID5 if undefined', function () {
const bidRequests = [
{
params: {placementId: '0'},
},
{
params: {placementId: '1'},
userId: {},
},
{
params: {placementId: '2'},
userId: undefined,
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request[0].data).to.not.have.property('id5Id');
expect(request[1].data).to.not.have.property('id5Id');
expect(request[2].data).to.not.have.property('id5Id');
});

it('should send ID5 if available', function () {
const bidRequests = [
{
params: {placementId: '0'},
userId: {id5id: {uid: 'id5id_sample'}},
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request[0].data.id5Id).to.equal('id5id_sample');
});
});
});

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

0 comments on commit eb8cc71

Please sign in to comment.