Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doceree bid adaptor: New GDPR related parameters #7815

Merged
merged 8 commits into from
Dec 13, 2021
11 changes: 10 additions & 1 deletion modules/docereeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ export const spec = {
const { placementId } = bid.params;
return !!placementId
},
isGdprConsentPresent: (bid) => {
const { gdpr, gdprConsent } = bid.params;
if (gdpr == '1') {
return !!gdprConsent
}
return true
},
buildRequests: (validBidRequests) => {
const serverRequests = [];
const { data } = config.getConfig('doceree.user')
const { page, domain, token } = config.getConfig('doceree.context')
const encodedUserInfo = window.btoa(encodeURIComponent(JSON.stringify(data)))

validBidRequests.forEach(function(validBidRequest) {
const { publisherUrl, placementId } = validBidRequest.params;
const { publisherUrl, placementId, gdpr, gdprConsent } = validBidRequest.params;
const url = publisherUrl || page
let queryString = '';
queryString = tryAppendQueryString(queryString, 'id', placementId);
Expand All @@ -32,6 +39,8 @@ export const spec = {
queryString = tryAppendQueryString(queryString, 'prebidjs', true);
queryString = tryAppendQueryString(queryString, 'token', token);
queryString = tryAppendQueryString(queryString, 'requestId', validBidRequest.bidId);
queryString = tryAppendQueryString(queryString, 'gdpr', gdpr);
queryString = tryAppendQueryString(queryString, 'gdpr_consent', gdprConsent);

serverRequests.push({
method: 'GET',
Expand Down
2 changes: 2 additions & 0 deletions modules/docereeBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var adUnits = [
params: {
placementId: 'DOC_7jm9j5eqkl0xvc5w', //required
publisherUrl: document.URL || window.location.href, //optional
gdpr: '1', //optional
gdprConsent:'CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g', //optional
}
}
]
Expand Down
10 changes: 9 additions & 1 deletion test/spec/modules/docereeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ describe('BidlabBidAdapter', function () {
bidder: 'doceree',
params: {
placementId: 'DOC_7jm9j5eqkl0xvc5w',
gdpr: '1',
gdprConsent: 'CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g'
}
};

Expand All @@ -44,6 +46,12 @@ describe('BidlabBidAdapter', function () {
});
});

describe('isGdprConsentPresent', function () {
it('Should return true if gdpr consent is present', function () {
expect(spec.isGdprConsentPresent(bid)).to.be.true;
});
});

describe('buildRequests', function () {
let serverRequest = spec.buildRequests([bid]);
serverRequest = serverRequest[0]
Expand All @@ -56,7 +64,7 @@ describe('BidlabBidAdapter', function () {
expect(serverRequest.method).to.equal('GET');
});
it('Returns valid URL', function () {
expect(serverRequest.url).to.equal('https://bidder.doceree.com/v1/adrequest?id=DOC_7jm9j5eqkl0xvc5w&pubRequestedURL=undefined&loggedInUser=JTdCJTIyZ2VuZGVyJTIyJTNBJTIyJTIyJTJDJTIyZW1haWwlMjIlM0ElMjIlMjIlMkMlMjJoYXNoZWRFbWFpbCUyMiUzQSUyMiUyMiUyQyUyMmZpcnN0TmFtZSUyMiUzQSUyMiUyMiUyQyUyMmxhc3ROYW1lJTIyJTNBJTIyJTIyJTJDJTIybnBpJTIyJTNBJTIyJTIyJTJDJTIyaGFzaGVkTlBJJTIyJTNBJTIyJTIyJTJDJTIyY2l0eSUyMiUzQSUyMiUyMiUyQyUyMnppcENvZGUlMjIlM0ElMjIlMjIlMkMlMjJzcGVjaWFsaXphdGlvbiUyMiUzQSUyMiUyMiU3RA%3D%3D&prebidjs=true&requestId=testing&');
expect(serverRequest.url).to.equal('https://bidder.doceree.com/v1/adrequest?id=DOC_7jm9j5eqkl0xvc5w&pubRequestedURL=undefined&loggedInUser=JTdCJTIyZ2VuZGVyJTIyJTNBJTIyJTIyJTJDJTIyZW1haWwlMjIlM0ElMjIlMjIlMkMlMjJoYXNoZWRFbWFpbCUyMiUzQSUyMiUyMiUyQyUyMmZpcnN0TmFtZSUyMiUzQSUyMiUyMiUyQyUyMmxhc3ROYW1lJTIyJTNBJTIyJTIyJTJDJTIybnBpJTIyJTNBJTIyJTIyJTJDJTIyaGFzaGVkTlBJJTIyJTNBJTIyJTIyJTJDJTIyY2l0eSUyMiUzQSUyMiUyMiUyQyUyMnppcENvZGUlMjIlM0ElMjIlMjIlMkMlMjJzcGVjaWFsaXphdGlvbiUyMiUzQSUyMiUyMiU3RA%3D%3D&prebidjs=true&requestId=testing&gdpr=1&gdpr_consent=CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g&');
});
});
describe('interpretResponse', function () {
Expand Down