Skip to content

Commit c4b0aff

Browse files
SkitelmanantoinfiveBrettBlox
authored
Concert Bid Adapter: add TDID (prebid#10549)
* collect EIDs for bid request * add ad slot positioning to payload * RPO-2012: Update local storage name-spacing for c_uid (#8) * Updates c_uid namespacing to be more specific for concert * fixes unit tests * remove console.log * RPO-2012: Add check for shared id (#9) * Adds check for sharedId * Updates cookie name * remove trailing comma * [RPO-3152] Enable Support for GPP Consent (#12) * Adds gpp consent integration to concert bid adapter * Update tests to check for gpp consent string param * removes user sync endpoint and tests * updates comment * cleans up consentAllowsPpid function * comment fix * rename variables for clarity * fixes conditional logic for consent allows function (#13) * [RPO-3262] Update getUid function to check for pubcid and sharedid (#14) * Update getUid function to check for pubcid and sharedid * updates adapter version * [RPO-3405] Add browserLanguage to request meta object * ConcertBidAdapter: Add TDID (#20) * Add tdid to meta object * Fix null handling and add tests --------- Co-authored-by: antoin <[email protected]> Co-authored-by: Antoin <[email protected]> Co-authored-by: Brett Bloxom <[email protected]>
1 parent fa8f9c1 commit c4b0aff

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

modules/concertBidAdapter.js

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const spec = {
4949
uspConsent: bidderRequest.uspConsent,
5050
gdprConsent: bidderRequest.gdprConsent,
5151
gppConsent: bidderRequest.gppConsent,
52+
tdid: getTdid(bidderRequest, validBidRequests),
5253
}
5354
};
5455

@@ -263,3 +264,11 @@ function getOffset(el) {
263264
};
264265
}
265266
}
267+
268+
function getTdid(bidderRequest, validBidRequests) {
269+
if (hasOptedOutOfPersonalization() || !consentAllowsPpid(bidderRequest)) {
270+
return null;
271+
}
272+
273+
return deepAccess(validBidRequests[0], 'userId.tdid') || null;
274+
}

test/spec/modules/concertBidAdapter_spec.js

+39-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,20 @@ describe('ConcertAdapter', function () {
116116
expect(payload).to.have.property('meta');
117117
expect(payload).to.have.property('slots');
118118

119-
const metaRequiredFields = ['prebidVersion', 'pageUrl', 'screen', 'debug', 'uid', 'optedOut', 'adapterVersion', 'uspConsent', 'gdprConsent', 'gppConsent', 'browserLanguage'];
119+
const metaRequiredFields = [
120+
'prebidVersion',
121+
'pageUrl',
122+
'screen',
123+
'debug',
124+
'uid',
125+
'optedOut',
126+
'adapterVersion',
127+
'uspConsent',
128+
'gdprConsent',
129+
'gppConsent',
130+
'browserLanguage',
131+
'tdid'
132+
];
120133
const slotsRequiredFields = ['name', 'bidId', 'transactionId', 'sizes', 'partnerId', 'slotType'];
121134

122135
metaRequiredFields.forEach(function(field) {
@@ -199,6 +212,31 @@ describe('ConcertAdapter', function () {
199212
expect(slot.offsetCoordinates.x).to.equal(100)
200213
expect(slot.offsetCoordinates.y).to.equal(0)
201214
})
215+
216+
it('should not pass along tdid if the user has opted out', function() {
217+
storage.setDataInLocalStorage('c_nap', 'true');
218+
const request = spec.buildRequests(bidRequests, bidRequest);
219+
const payload = JSON.parse(request.data);
220+
221+
expect(payload.meta.tdid).to.be.null;
222+
});
223+
224+
it('should not pass along tdid if USP consent disallows', function() {
225+
storage.removeDataFromLocalStorage('c_nap');
226+
const request = spec.buildRequests(bidRequests, { ...bidRequest, uspConsent: '1YY' });
227+
const payload = JSON.parse(request.data);
228+
229+
expect(payload.meta.tdid).to.be.null;
230+
});
231+
232+
it('should pass along tdid if the user has not opted out', function() {
233+
storage.removeDataFromLocalStorage('c_nap', 'true');
234+
const tdid = '123abc';
235+
const bidRequestsWithTdid = [{ ...bidRequests[0], userId: { tdid } }]
236+
const request = spec.buildRequests(bidRequestsWithTdid, bidRequest);
237+
const payload = JSON.parse(request.data);
238+
expect(payload.meta.tdid).to.equal(tdid);
239+
});
202240
});
203241

204242
describe('spec.interpretResponse', function() {

0 commit comments

Comments
 (0)