Skip to content

Commit

Permalink
Concert Bid Adapter: add TDID (#10549)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Sep 29, 2023
1 parent fa8f9c1 commit c4b0aff
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
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

0 comments on commit c4b0aff

Please sign in to comment.