Skip to content

Commit

Permalink
Added support for 3rd party user IDs (prebid#9105)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubuntu <[email protected]>
  • Loading branch information
2 people authored and JacobKlein26 committed Feb 8, 2023
1 parent f9b2f5f commit 4dbe737
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 7 additions & 1 deletion modules/vrtcalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const spec = {
let ccpa = '';
let coppa = 0;
let tmax = 0;
let eids = [];

if (bidRequests[0].userIdAsEids && bidRequests[0].userIdAsEids.length > 0) {
eids = bidRequests[0].userIdAsEids;
}

if (bid && bid.gdprConsent) {
gdprApplies = bid.gdprConsent.gdprApplies ? 1 : 0;
Expand Down Expand Up @@ -74,7 +79,8 @@ export const spec = {
},
user: {
ext: {
consent: gdprConsent
consent: gdprConsent,
eids: eids
}
}
};
Expand Down
13 changes: 12 additions & 1 deletion test/spec/modules/vrtcalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai'
import { spec } from 'modules/vrtcalBidAdapter'
import { newBidder } from 'src/adapters/bidderFactory'
import { config } from 'src/config.js';
import { createEidsArray } from 'modules/userId/eids.js';

describe('vrtcalBidAdapter', function () {
const adapter = newBidder(spec)
Expand All @@ -27,6 +28,7 @@ describe('vrtcalBidAdapter', function () {
'bidId': 'bidID0001',
'bidderRequestId': 'br0001',
'auctionId': 'auction0001',
'userIdAsEids': {}
}
];

Expand Down Expand Up @@ -58,7 +60,7 @@ describe('vrtcalBidAdapter', function () {
config.setConfig({ coppa: false });

request = spec.buildRequests(bidRequests);
expect(request[0].data).to.match(/"user":{"ext":{"consent":"gdpr-consent-string"}}/);
expect(request[0].data).to.match(/"user":{"ext":{"consent":"gdpr-consent-string"/);
expect(request[0].data).to.match(/"regs":{"coppa":0,"ext":{"gdpr":1,"us_privacy":"ccpa-consent-string"}}/);
});

Expand All @@ -67,6 +69,15 @@ describe('vrtcalBidAdapter', function () {
request = spec.buildRequests(bidRequests);
expect(request[0].data).to.match(/"tmax":435/);
});

it('pass 3rd party IDs with the request when present', function () {
bidRequests[0].userIdAsEids = createEidsArray({
tdid: 'TTD_ID_FROM_USER_ID_MODULE'
});

request = spec.buildRequests(bidRequests);
expect(request[0].data).to.include(JSON.stringify({ext: {consent: 'gdpr-consent-string', eids: [{source: 'adserver.org', uids: [{id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: {rtiPartner: 'TDID'}}]}]}}));
});
});

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

0 comments on commit 4dbe737

Please sign in to comment.