Skip to content

Commit

Permalink
Concert Bid Adapter: Enable support for additional userId's (prebid#9780
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

---------

Co-authored-by: antoin <antoin.campbell@voxmedia.com>
Co-authored-by: Antoin <antoinfive@gmail.com>
  • Loading branch information
3 people authored Apr 10, 2023
1 parent 5b118ff commit 86e6ef5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
21 changes: 14 additions & 7 deletions modules/concertBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export const spec = {
pageUrl: bidderRequest.refererInfo.page,
screen: [window.screen.width, window.screen.height].join('x'),
debug: debugTurnedOn(),
uid: getUid(bidderRequest),
uid: getUid(bidderRequest, validBidRequests),
optedOut: hasOptedOutOfPersonalization(),
adapterVersion: '1.1.1',
adapterVersion: '1.2.0',
uspConsent: bidderRequest.uspConsent,
gdprConsent: bidderRequest.gdprConsent,
gppConsent: bidderRequest.gppConsent,
Expand Down Expand Up @@ -158,16 +158,23 @@ export const storage = getStorageManager({bidderCode: BIDDER_CODE});
/**
* Check or generate a UID for the current user.
*/
function getUid(bidderRequest) {
function getUid(bidderRequest, validBidRequests) {
if (hasOptedOutOfPersonalization() || !consentAllowsPpid(bidderRequest)) {
return false;
}

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

if (sharedId) {
return sharedId;
}
if (sharedId) return sharedId;
if (pubCid) return pubCid;

const LEGACY_CONCERT_UID_KEY = 'c_uid';
const CONCERT_UID_KEY = 'vmconcert_uid';
Expand Down
11 changes: 3 additions & 8 deletions test/spec/modules/concertBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,10 @@ describe('ConcertAdapter', function () {

it('should use sharedid if it exists', function() {
storage.removeDataFromLocalStorage('c_nap');
const request = spec.buildRequests(bidRequests, {
...bidRequest,
userId: {
_sharedid: {
id: '123abc'
}
}
});
const bidRequestsWithSharedId = [{ ...bidRequests[0], userId: { sharedid: { id: '123abc' } } }]
const request = spec.buildRequests(bidRequestsWithSharedId, bidRequest);
const payload = JSON.parse(request.data);

expect(payload.meta.uid).to.equal('123abc');
})

Expand Down

0 comments on commit 86e6ef5

Please sign in to comment.