Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcertBidAdapter: Add TDID #20

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/concertBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const spec = {
uspConsent: bidderRequest.uspConsent,
gdprConsent: bidderRequest.gdprConsent,
gppConsent: bidderRequest.gppConsent,
tdid: getTdid(bidderRequest, validBidRequests),
}
};

Expand Down Expand Up @@ -263,3 +264,11 @@ function getOffset(el) {
};
}
}

function getTdid(bidderRequest, validBidRequests) {
if (hasOptedOutOfPersonalization() || !consentAllowsPpid(bidderRequest)) {
return null;
}

return deepAccess(validBidRequests[0], 'userId.tdid') || null;
}
40 changes: 39 additions & 1 deletion test/spec/modules/concertBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,20 @@ describe('ConcertAdapter', function () {
expect(payload).to.have.property('meta');
expect(payload).to.have.property('slots');

const metaRequiredFields = ['prebidVersion', 'pageUrl', 'screen', 'debug', 'uid', 'optedOut', 'adapterVersion', 'uspConsent', 'gdprConsent', 'gppConsent', 'browserLanguage'];
const metaRequiredFields = [
'prebidVersion',
'pageUrl',
'screen',
'debug',
'uid',
'optedOut',
'adapterVersion',
'uspConsent',
'gdprConsent',
'gppConsent',
'browserLanguage',
'tdid'
];
const slotsRequiredFields = ['name', 'bidId', 'transactionId', 'sizes', 'partnerId', 'slotType'];

metaRequiredFields.forEach(function(field) {
Expand Down Expand Up @@ -199,6 +212,31 @@ describe('ConcertAdapter', function () {
expect(slot.offsetCoordinates.x).to.equal(100)
expect(slot.offsetCoordinates.y).to.equal(0)
})

it('should not pass along tdid if the user has opted out', function() {
storage.setDataInLocalStorage('c_nap', 'true');
const request = spec.buildRequests(bidRequests, bidRequest);
const payload = JSON.parse(request.data);

expect(payload.meta.tdid).to.be.null;
});

it('should not pass along tdid if USP consent disallows', function() {
storage.removeDataFromLocalStorage('c_nap');
const request = spec.buildRequests(bidRequests, { ...bidRequest, uspConsent: '1YY' });
const payload = JSON.parse(request.data);

expect(payload.meta.tdid).to.be.null;
});

it('should pass along tdid if the user has not opted out', function() {
storage.removeDataFromLocalStorage('c_nap', 'true');
const tdid = '123abc';
const bidRequestsWithTdid = [{ ...bidRequests[0], userId: { tdid } }]
const request = spec.buildRequests(bidRequestsWithTdid, bidRequest);
const payload = JSON.parse(request.data);
expect(payload.meta.tdid).to.equal(tdid);
});
});

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