Skip to content

Commit

Permalink
Added option to pass a user id through ortb2. (prebid#7639)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikael-lundin authored and Chris Pabst committed Jan 10, 2022
1 parent d50ba51 commit 7ef3e2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const handleMeta = function () {
}

const getUsi = function (meta, ortb2, bidderRequest) {
const usi = (meta !== null) ? meta.usi : false;
let usi = (meta !== null && meta.usi) ? meta.usi : false;
if (ortb2 && ortb2.user && ortb2.user.id) { usi = ortb2.user.id }
return usi
}

Expand Down
18 changes: 18 additions & 0 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,24 @@ describe('adnuntiusBidAdapter', function () {
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
});

it('should user user ID if present in ortb2.user.id field', function () {
config.setBidderConfig({
bidders: ['adnuntius', 'other'],
config: {
ortb2: {
user: {
id: usi
}
}
}
});

const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL);
});
});

describe('user privacy', function () {
Expand Down

0 comments on commit 7ef3e2b

Please sign in to comment.