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

Adnuntius Bid Adapter: update on no cookies parameter #7875

Merged
merged 11 commits into from
Feb 1, 2022
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
6 changes: 3 additions & 3 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ describe('gumgumAdapter', function () {
slotRequest.params.slot = invalidSlotId;
legacySlotRequest.params.inSlot = invalidSlotId;

req = spec.buildRequests([ slotRequest ])[0];
legReq = spec.buildRequests([ legacySlotRequest ])[0];
req = spec.buildRequests([slotRequest])[0];
legReq = spec.buildRequests([legacySlotRequest])[0];

expect(req.data.si).to.equal(invalidSlotId);
expect(legReq.data.si).to.equal(invalidSlotId);
Expand Down Expand Up @@ -696,7 +696,7 @@ describe('gumgumAdapter', function () {
it('uses request size that nearest matches response size for in-screen', function () {
const request = { ...bidRequest };
const body = { ...serverResponse };
const expectedSize = [ 300, 50 ];
const expectedSize = [300, 50];
let result;

request.pi = 2;
Expand Down