diff --git a/modules/yieldoneBidAdapter.js b/modules/yieldoneBidAdapter.js index 95c0a5b787a..98a95b6758e 100644 --- a/modules/yieldoneBidAdapter.js +++ b/modules/yieldoneBidAdapter.js @@ -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, diff --git a/test/spec/modules/yieldoneBidAdapter_spec.js b/test/spec/modules/yieldoneBidAdapter_spec.js index eef25649a02..e41764b2876 100644 --- a/test/spec/modules/yieldoneBidAdapter_spec.js +++ b/test/spec/modules/yieldoneBidAdapter_spec.js @@ -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 () {