Skip to content

Commit

Permalink
Update Criteo bid adapter to send undefined GDPR consent fields inste…
Browse files Browse the repository at this point in the history
…ad of default false value when values are not defined (prebid#2630)

* Convert Criteo adapter to bidderFactory

* Add documentation for Prebid 1.0 Criteo adapter

* Add support for zone-matching bids on Prebid 1.0 Criteo adapter

* Add unit tests to the Prebid 1.0 Criteo adapter

* Explicit the fact that Criteo bids are net revenue

* Pass currency in Criteo 1.0 adapter

* Update Criteo adapter to use PublisherTag if present

* Implement fastbid in prebid 1.0 criteo adapter

* Pass the bid requests to the Criteo interpret method

* Add missing ttl and creativeId fields to Criteo bids

* Add 'native' support to the Criteo adapter

* Check that the Criteo adapter returned by PublisherTag is not empty

* Update criteo prebid adapter to reload publisher tag once auction is
finished

* Fix 'assign to const' IE errors in Criteo native adapter

* Disable the PublisherTag event queue

* Fix Criteo adapter on older Prebid versions not using response.body

* Fix TypeError if FastBid is outdated

* Remove the success variable in tryGetCriteoFastBid

* Fix events being overwritten with FastBid

* Update PublisherTag loading comment

* Use adUnitCode as impid

* Add events handlers in Criteo adapter to fix timeouts not treated as such

* Add handler for setTargeting event

* Move the registeredEvents set higher up to reduce the chances of race conditions

* Fix UTests following recent Criteo adapter changes

* Add comment linking to the PublisherTag unminified source

* Do not return a request in buildRequests on error

In some cases, the buildCdbRequest function might return a falsy value,
in case of error in creating the request or if we know in advance that
this request will return a no-bid.

In this case, the buildRequests() method should not return a request,
causing a no-bid.

* Use loadExternalScript instead of loadScript

* Use spec.onTimeout instead of registering an event handler

* GDPR support in Criteo adapter (#4)

GDPR support in Criteo adapter

* Remove BID_WON and SET_TARGETING events from Criteo adapter

* Update adapter version

* Add support for multi-size in Criteo adapter

* Fix support for multi size in Criteo adapter

* Update adapterVersion to 7

* GDPR support criteo: send undefined gdpr consent fields instead of false
when not defined

* Update adapterVersion to 8
  • Loading branch information
ahubertcriteo authored and dluxemburg committed Jul 17, 2018
1 parent 2606600 commit b900f34
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
19 changes: 12 additions & 7 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parse } from 'src/url';
import * as utils from 'src/utils';
import find from 'core-js/library/fn/array/find';

const ADAPTER_VERSION = 7;
const ADAPTER_VERSION = 8;
const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = '//bidder.criteo.com/cdb';
const CRITEO_VENDOR_ID = 91;
Expand Down Expand Up @@ -208,12 +208,17 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
request.publisher.networkid = networkId;
}
if (bidderRequest && bidderRequest.gdprConsent) {
request.gdprConsent = {
gdprApplies: !!(bidderRequest.gdprConsent.gdprApplies),
consentData: bidderRequest.gdprConsent.consentString,
consentGiven: !!(bidderRequest.gdprConsent.vendorData && bidderRequest.gdprConsent.vendorData.vendorConsents &&
bidderRequest.gdprConsent.vendorData.vendorConsents[ CRITEO_VENDOR_ID.toString(10) ]),
};
request.gdprConsent = {};
if (typeof bidderRequest.gdprConsent.gdprApplies !== 'undefined') {
request.gdprConsent.gdprApplies = !!(bidderRequest.gdprConsent.gdprApplies);
}
if (bidderRequest.gdprConsent.vendorData && bidderRequest.gdprConsent.vendorData.vendorConsents &&
typeof bidderRequest.gdprConsent.vendorData.vendorConsents[ CRITEO_VENDOR_ID.toString(10) ] !== 'undefined') {
request.gdprConsent.consentGiven = !!(bidderRequest.gdprConsent.vendorData.vendorConsents[ CRITEO_VENDOR_ID.toString(10) ]);
}
if (typeof bidderRequest.gdprConsent.consentString !== 'undefined') {
request.gdprConsent.consentData = bidderRequest.gdprConsent.consentString;
}
}
return request;
}
Expand Down
25 changes: 24 additions & 1 deletion test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('The Criteo bidding adapter', () => {
expect(ortbRequest.slots[0].sizes[1]).to.equal('728x90');
expect(ortbRequest.gdprConsent.consentData).to.equal(undefined);
expect(ortbRequest.gdprConsent.gdprApplies).to.equal(false);
expect(ortbRequest.gdprConsent.consentGiven).to.equal(false);
expect(ortbRequest.gdprConsent.consentGiven).to.equal(undefined);
});

it('should properly build a mixed request', () => {
Expand Down Expand Up @@ -169,6 +169,29 @@ describe('The Criteo bidding adapter', () => {
expect(ortbRequest.slots[1].sizes[1]).to.equal('728x90');
expect(ortbRequest.gdprConsent).to.equal(undefined);
});

it('should properly build request with undefined gdpr consent fields when they are not provided', () => {
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
sizes: [[728, 90]],
params: {
zoneId: 123,
},
},
];
const bidderRequest = { timeout: 3000,
gdprConsent: {
},
};

const ortbRequest = spec.buildRequests(bidRequests, bidderRequest).data;
expect(ortbRequest.gdprConsent.consentData).to.equal(undefined);
expect(ortbRequest.gdprConsent.gdprApplies).to.equal(undefined);
expect(ortbRequest.gdprConsent.consentGiven).to.equal(undefined);
});
});

describe('interpretResponse', () => {
Expand Down

0 comments on commit b900f34

Please sign in to comment.