Skip to content

Commit 7f0205a

Browse files
nkloeberkippsterr
authored andcommitted
Yieldlab Bid Adapter: read and pass UserIdsAsEids atype information (prebid#9370)
* YieldlabBidAdapter read atype information from UserIdsAsEids and pass it as query parameter (atypes={idprovider}:{atype},{idprovider2}:{atype2},...) * Update type hint and add semi colons Co-authored-by: Christoph Kipping <[email protected]>
1 parent 8ea61d3 commit 7f0205a

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

modules/yieldlabBidAdapter.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const spec = {
6262
}
6363
if (bid.userIdAsEids && Array.isArray(bid.userIdAsEids)) {
6464
query.ids = createUserIdString(bid.userIdAsEids)
65+
query.atypes = createUserIdAtypesString(bid.userIdAsEids)
6566
}
6667
if (bid.params.customParams && isPlainObject(bid.params.customParams)) {
6768
for (const prop in bid.params.customParams) {
@@ -303,6 +304,21 @@ function createUserIdString(eids) {
303304
return str.join(',')
304305
}
305306

307+
/**
308+
* Creates a string from an array of eids with ID provider and atype if atype exists
309+
* @param {Array.<{source: String, uids: Array.<{id: String, atype: Number, ext: Object}>}>} eids
310+
* @returns {String} idprovider:atype,idprovider2:atype2,...
311+
*/
312+
function createUserIdAtypesString(eids) {
313+
const str = [];
314+
for (let i = 0; i < eids.length; i++) {
315+
if (eids[i].uids[0].atype) {
316+
str.push(eids[i].source + ':' + eids[i].uids[0].atype);
317+
}
318+
}
319+
return str.join(',');
320+
}
321+
306322
/**
307323
* Creates a querystring out of an object with key-values
308324
* @param {Object} obj

test/spec/modules/yieldlabBidAdapter_spec.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ const DEFAULT_REQUEST = () => ({
4545
id: 'fH5A3n2O8_CZZyPoJVD-eabc6ECb7jhxCicsds7qSg',
4646
atype: 1
4747
}]
48+
}, {
49+
source: 'digitrust.de',
50+
uids: [{
51+
id: 'd8aa10fa-d86c-451d-aad8-5f16162a9e64',
52+
atype: 2
53+
}]
4854
}],
4955
schain: {
5056
ver: '1.0',
@@ -271,7 +277,11 @@ describe('yieldlabBidAdapter', () => {
271277
})
272278

273279
it('passes userids to bid request', () => {
274-
expect(request.url).to.include('ids=netid.de%3AfH5A3n2O8_CZZyPoJVD-eabc6ECb7jhxCicsds7qSg')
280+
expect(request.url).to.include('ids=netid.de%3AfH5A3n2O8_CZZyPoJVD-eabc6ECb7jhxCicsds7qSg%2Cdigitrust.de%3Ad8aa10fa-d86c-451d-aad8-5f16162a9e64')
281+
})
282+
283+
it('passes atype to bid request', () => {
284+
expect(request.url).to.include('atypes=netid.de%3A1%2Cdigitrust.de%3A2')
275285
})
276286

277287
it('passes extra params to bid request', () => {

0 commit comments

Comments
 (0)