Skip to content

Commit

Permalink
ADOT Bid Adapter: handle schain & pubProvidedId (#8670)
Browse files Browse the repository at this point in the history
* [DSP-3689] feature: add pubProvidedId to user (#6)

[DSP-3689] feature: add pubProvidedId to user

* [DSP-3690] feature: Handle schain object (#7)
  • Loading branch information
ako-adot authored Jul 11, 2022
1 parent cae46d6 commit b09f9f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
11 changes: 10 additions & 1 deletion modules/adotBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ function getOpenRTBSiteObject(bidderRequest) {
name: domain,
publisher: {
id: publisherId
},
ext: {
schain: bidderRequest.schain
}
};
}
Expand All @@ -83,7 +86,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
21 changes: 12 additions & 9 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' }, schain: { ver: '1.0' } };

const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
Expand All @@ -54,10 +54,11 @@ describe('Adot Adapter', function () {
publisher: {
// id: 'adot'
id: undefined
}
},
ext: { schain: { ver: '1.0' } }
},
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 +77,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' }, schain: { ver: '1.0' } };

const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
Expand All @@ -101,10 +102,11 @@ describe('Adot Adapter', function () {
publisher: {
// id: 'adot'
id: undefined
}
},
ext: { schain: { ver: '1.0' } }
},
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 +125,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' }, schain: { ver: '1.0' } };

const request = spec.buildRequests(validBidRequests, bidderRequest);
const buildBidRequestResponse = {
Expand Down Expand Up @@ -160,10 +162,11 @@ describe('Adot Adapter', function () {
publisher: {
// id: 'adot'
id: undefined
}
},
ext: { schain: { ver: '1.0' } }
},
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 b09f9f0

Please sign in to comment.