Skip to content

Commit

Permalink
RPO-2012: Add check for shared id (#9)
Browse files Browse the repository at this point in the history
* Adds check for sharedId

* Updates cookie name

* remove trailing comma
  • Loading branch information
BrettBlox committed Nov 4, 2022
1 parent c54b011 commit 2bb7143
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion modules/concertBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logWarn, logMessage, debugTurnedOn, generateUUID } from '../src/utils.js';
import { logWarn, logMessage, debugTurnedOn, generateUUID, deepAccess } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';
import { hasPurpose1Consent } from '../src/utils/gpdr.js';
Expand Down Expand Up @@ -188,6 +188,12 @@ function getUid(bidderRequest) {
return false;
}

const sharedId = deepAccess(bidderRequest, 'userId._sharedid.id');

if (sharedId) {
return sharedId;
}

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

Expand Down
16 changes: 15 additions & 1 deletion test/spec/modules/concertBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,21 @@ describe('ConcertAdapter', function () {
expect(payload.meta.uid).to.not.equal(false);
});

it('should grab uid from local storage if it exists', function() {
it('should use sharedid if it exists', function() {
storage.removeDataFromLocalStorage('c_nap');
const request = spec.buildRequests(bidRequests, {
...bidRequest,
userId: {
_sharedid: {
id: '123abc'
}
}
});
const payload = JSON.parse(request.data);
expect(payload.meta.uid).to.equal('123abc');
})

it('should grab uid from local storage if it exists and sharedid does not', function() {
storage.setDataInLocalStorage('vmconcert_uid', 'foo');
storage.removeDataFromLocalStorage('c_nap');
const request = spec.buildRequests(bidRequests, bidRequest);
Expand Down

0 comments on commit 2bb7143

Please sign in to comment.