Skip to content

Commit 86e6ef5

Browse files
Concert Bid Adapter: Enable support for additional userId's (prebid#9780)
* 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 --------- Co-authored-by: antoin <[email protected]> Co-authored-by: Antoin <[email protected]>
1 parent 5b118ff commit 86e6ef5

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

modules/concertBidAdapter.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export const spec = {
4242
pageUrl: bidderRequest.refererInfo.page,
4343
screen: [window.screen.width, window.screen.height].join('x'),
4444
debug: debugTurnedOn(),
45-
uid: getUid(bidderRequest),
45+
uid: getUid(bidderRequest, validBidRequests),
4646
optedOut: hasOptedOutOfPersonalization(),
47-
adapterVersion: '1.1.1',
47+
adapterVersion: '1.2.0',
4848
uspConsent: bidderRequest.uspConsent,
4949
gdprConsent: bidderRequest.gdprConsent,
5050
gppConsent: bidderRequest.gppConsent,
@@ -158,16 +158,23 @@ export const storage = getStorageManager({bidderCode: BIDDER_CODE});
158158
/**
159159
* Check or generate a UID for the current user.
160160
*/
161-
function getUid(bidderRequest) {
161+
function getUid(bidderRequest, validBidRequests) {
162162
if (hasOptedOutOfPersonalization() || !consentAllowsPpid(bidderRequest)) {
163163
return false;
164164
}
165165

166-
const sharedId = deepAccess(bidderRequest, 'userId._sharedid.id');
166+
/**
167+
* check for shareId or pubCommonId before generating a new one
168+
* sharedId: @see https://docs.prebid.org/dev-docs/modules/userId.html
169+
* pubCid (no longer supported): @see https://docs.prebid.org/dev-docs/modules/pubCommonId.html#adapter-integration
170+
*/
171+
const sharedId =
172+
deepAccess(validBidRequests[0], 'userId.sharedid.id') ||
173+
deepAccess(validBidRequests[0], 'userId.pubcid')
174+
const pubCid = deepAccess(validBidRequests[0], 'crumbs.pubcid');
167175

168-
if (sharedId) {
169-
return sharedId;
170-
}
176+
if (sharedId) return sharedId;
177+
if (pubCid) return pubCid;
171178

172179
const LEGACY_CONCERT_UID_KEY = 'c_uid';
173180
const CONCERT_UID_KEY = 'vmconcert_uid';

test/spec/modules/concertBidAdapter_spec.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,10 @@ describe('ConcertAdapter', function () {
149149

150150
it('should use sharedid if it exists', function() {
151151
storage.removeDataFromLocalStorage('c_nap');
152-
const request = spec.buildRequests(bidRequests, {
153-
...bidRequest,
154-
userId: {
155-
_sharedid: {
156-
id: '123abc'
157-
}
158-
}
159-
});
152+
const bidRequestsWithSharedId = [{ ...bidRequests[0], userId: { sharedid: { id: '123abc' } } }]
153+
const request = spec.buildRequests(bidRequestsWithSharedId, bidRequest);
160154
const payload = JSON.parse(request.data);
155+
161156
expect(payload.meta.uid).to.equal('123abc');
162157
})
163158

0 commit comments

Comments
 (0)