Skip to content

Commit

Permalink
Doceree AdManager Bid Adapter : added support for TCF 2.2 (#12226)
Browse files Browse the repository at this point in the history
* Updated docereeAdManager bid adapter

* Updated docereeAdManager bid adapter

* Updated docereeAdManager bid adapter

* Updated docereeAdManager bid adapter

* Updated docereeAdManager bid adapter

* Updated docereeAdManager bid adapter

* Update docereeAdManagerBidAdapter.js

* added test cases for payload formation in DocereeAdManager

* Added support for publisherUrl

* added some parameters

* Added support for TCF 2.2

---------

Co-authored-by: lokesh-doceree <Lokesh.Kumar@doceree.com>
Co-authored-by: Patrick McCann <patmmccann@gmail.com>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent 88ec0b2 commit 219283e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
19 changes: 16 additions & 3 deletions modules/docereeAdManagerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export const spec = {
}
return true;
},
buildRequests: (validBidRequests) => {
buildRequests: (validBidRequests, bidderRequest) => {
const serverRequests = [];
const { data } = config.getConfig('docereeadmanager.user') || {};

validBidRequests.forEach(function (validBidRequest) {
const payload = getPayload(validBidRequest, data);
const payload = getPayload(validBidRequest, data, bidderRequest);

if (!payload) {
return;
Expand Down Expand Up @@ -70,7 +70,7 @@ export const spec = {
},
};

export function getPayload(bid, userData) {
export function getPayload(bid, userData, bidderRequest) {
if (!userData || !bid) {
return false;
}
Expand Down Expand Up @@ -123,6 +123,19 @@ export function getPayload(bid, userData) {
mobile: mobile || '',
pageurl: publisherUrl || ''
};

try {
if (bidderRequest && bidderRequest.gdprConsent) {
const { gdprApplies, consentString } = bidderRequest.gdprConsent;
data['consent'] = {
'gdpr': gdprApplies ? 1 : 0,
'gdprstr': consentString || '',
}
}
} catch (error) {

}

return {
data,
};
Expand Down
13 changes: 11 additions & 2 deletions test/spec/modules/docereeAdManagerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ describe('docereeadmanager', function () {
mobile: 'XXXXXXXXXX',
}
bid = {...bid, params: {...bid.params, placementId: 'DOC-19-1'}}
const payload = getPayload(bid, data);
const buildRequests = {
gdprConsent: {
consentString: 'COwK6gaOwK6gaFmAAAENAPCAAAAAAAAAAAAAAAAAAAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
gdprApplies: false
}
}
const payload = getPayload(bid, data, buildRequests);
const payloadData = payload.data;
expect(payloadData).to.have.all.keys(
'userid',
Expand All @@ -174,7 +180,8 @@ describe('docereeadmanager', function () {
'dob',
'userconsent',
'mobile',
'pageurl'
'pageurl',
'consent'
);
expect(payloadData.userid).to.equal('Xx.xxx.xxxxxx');
expect(payloadData.email).to.equal('xxxx@mail.com');
Expand All @@ -199,6 +206,8 @@ describe('docereeadmanager', function () {
expect(payloadData.mobile).to.equal('XXXXXXXXXX');
expect(payloadData.adunit).to.equal('DOC-19-1');
expect(payloadData.pageurl).to.equal('xxxxxx.com/xxxx');
expect(payloadData.consent.gdprstr).to.equal('COwK6gaOwK6gaFmAAAENAPCAAAAAAAAAAAAAAAAAAAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw');
expect(payloadData.consent.gdpr).to.equal(0);
})
})
});

0 comments on commit 219283e

Please sign in to comment.