Skip to content

Commit

Permalink
Adnuntius Bid Adapter: no cookie feature. (#7768)
Browse files Browse the repository at this point in the history
* Added option to pass a user id through ortb2.

* check if use cookie is present in config, and use it accordingly.

* Adding test for no cookie url addition.
  • Loading branch information
mikael-lundin authored Dec 1, 2021
1 parent f011bbc commit 3905480
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export const spec = {
const requests = [];
const request = [];
const ortb2 = config.getConfig('ortb2');
const bidderConfig = config.getConfig();

const adnMeta = handleMeta()
const usi = getUsi(adnMeta, ortb2, bidderRequest)
const segments = getSegmentsFromOrtb(ortb2);
Expand All @@ -68,7 +70,7 @@ export const spec = {
if (gdprApplies !== undefined) request.push('consentString=' + consentString);
if (segments.length > 0) request.push('segments=' + segments.join(','));
if (usi) request.push('userId=' + usi);

if (bidderConfig.useCookie === false) request.push('noCookies=true')
for (var i = 0; i < validBidRequests.length; i++) {
const bid = validBidRequests[i]
const network = bid.params.network || 'network';
Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('adnuntiusBidAdapter', function () {
});
const tzo = new Date().getTimezoneOffset();
const ENDPOINT_URL = `${URL}${tzo}&format=json&userId=${usi}`;
const ENDPOINT_URL_NOCOOKIE = `${URL}${tzo}&format=json&userId=${usi}&noCookies=true`;
const ENDPOINT_URL_SEGMENTS = `${URL}${tzo}&format=json&segments=segment1,segment2,segment3&userId=${usi}`;
const ENDPOINT_URL_CONSENT = `${URL}${tzo}&format=json&consentString=consentString&userId=${usi}`;
const adapter = newBidder(spec);
Expand Down Expand Up @@ -287,6 +288,22 @@ describe('adnuntiusBidAdapter', function () {
});
});

describe('use cookie', function () {
it('should send noCookie in url if set to false.', function () {
config.setBidderConfig({
bidders: ['adnuntius'],
config: {
useCookie: false
}
});

const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_NOCOOKIE);
});
});

describe('interpretResponse', function () {
it('should return valid response when passed valid server response', function () {
const interpretedResponse = spec.interpretResponse(serverResponse, singleBidRequest);
Expand Down

0 comments on commit 3905480

Please sign in to comment.