Skip to content

Commit

Permalink
[DSP-3689] feature: add pubProvidedId to user (#6)
Browse files Browse the repository at this point in the history
[DSP-3689] feature: add pubProvidedId to user
  • Loading branch information
ako-adot authored Jul 8, 2022
1 parent 7727be0 commit 0aef0af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion modules/adotBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ function getOpenRTBDeviceObject() {
*/
function getOpenRTBUserObject(bidderRequest) {
if (!bidderRequest || !bidderRequest.gdprConsent || !isStr(bidderRequest.gdprConsent.consentString)) return null;
return { ext: { consent: bidderRequest.gdprConsent.consentString } };

return {
ext: {
consent: bidderRequest.gdprConsent.consentString,
pubProvidedId: bidderRequest.userId && bidderRequest.userId.pubProvidedId,
},
};
}

/**
Expand Down
12 changes: 6 additions & 6 deletions test/spec/modules/adotBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Adot Adapter', function () {
it('should build request (banner)', function () {
const bidderRequestId = 'bidderRequestId';
const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { banner: { sizes: [[300, 250]] } }, params: { placementId: 'placementId', adUnitCode: 200 } }];
const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true }, userId: { pubProvidedId: 'userId' } };

const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Adot Adapter', function () {
}
},
device: { ua: navigator.userAgent, language: navigator.language },
user: { ext: { consent: bidderRequest.gdprConsent.consentString } },
user: { ext: { consent: bidderRequest.gdprConsent.consentString, pubProvidedId: 'userId' } },
regs: { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies } },
ext: {
adot: { adapter_version: 'v2.0.0' },
Expand All @@ -76,7 +76,7 @@ describe('Adot Adapter', function () {
it('should build request (native)', function () {
const bidderRequestId = 'bidderRequestId';
const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { native: { title: { required: true, len: 50, sizes: [[300, 250]] }, wrong: {}, image: {} } }, params: { placementId: 'placementId', adUnitCode: 200 } }];
const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true }, userId: { pubProvidedId: 'userId' } };

const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('Adot Adapter', function () {
}
},
device: { ua: navigator.userAgent, language: navigator.language },
user: { ext: { consent: bidderRequest.gdprConsent.consentString } },
user: { ext: { consent: bidderRequest.gdprConsent.consentString, pubProvidedId: 'userId' } },
regs: { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies } },
ext: {
adot: { adapter_version: 'v2.0.0' },
Expand All @@ -123,7 +123,7 @@ describe('Adot Adapter', function () {
it('should build request (video)', function () {
const bidderRequestId = 'bidderRequestId';
const validBidRequests = [{ bidderRequestId, mediaTypes: {} }, { bidderRequestId, bidId: 'bidId', mediaTypes: { video: { playerSize: [[300, 250]], minduration: 1, maxduration: 2, api: 'api', linearity: 'linearity', mimes: [], placement: 'placement', playbackmethod: 'playbackmethod', protocols: 'protocol', startdelay: 'startdelay' } }, params: { placementId: 'placementId', adUnitCode: 200 } }];
const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true } };
const bidderRequest = { position: 2, refererInfo: { page: 'http://localhost.com', domain: 'localhost.com' }, gdprConsent: { consentString: 'consentString', gdprApplies: true }, userId: { pubProvidedId: 'userId' } };

const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('Adot Adapter', function () {
}
},
device: { ua: navigator.userAgent, language: navigator.language },
user: { ext: { consent: bidderRequest.gdprConsent.consentString } },
user: { ext: { consent: bidderRequest.gdprConsent.consentString, pubProvidedId: 'userId' } },
regs: { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies } },
ext: {
adot: { adapter_version: 'v2.0.0' },
Expand Down

0 comments on commit 0aef0af

Please sign in to comment.