Skip to content

Commit

Permalink
LiveWrapper Bid Adapter: add US privacy and Coppa support (prebid#6569)
Browse files Browse the repository at this point in the history
* Livewrapped bid and analytics adapter

* Fixed some tests for browser compatibility

* Fixed some tests for browser compatibility

* Changed analytics adapter code name

* Fix double quote in debug message

* modified how gdpr is being passed

* Added support for Publisher Common ID Module

* Corrections for ttr in analytics

* ANalytics updates

* Auction start time stamp changed

* Detect recovered ad blocked requests
Make it possible to pass dynamic parameters to adapter

* Collect info on ad units receiving any valid bid

* Support for ID5
Pass metadata from adapter

* Typo in test + eids on wrong level

* Fix for Prebid 3.0

* Fix get referer

* http -> https in tests

* Native support

* Read sizes from mediatype.banner

* Revert accidental commit

* Support native data collection + minor refactorings

* Set analytics endpoint

* Support for app parameters

* Fix issue where adunits with bids were not counted on reload

* Send debug info from adapter to external debugger

* SChain support

* Send GDPR data in analytics request

* video support

Video support

* Report back floor via analytic

* Send auction id and adunit/bidder connection id

* Criteo id support

* Updated example

* livewrapped Analytics Adapter info file

* Livewrapped gvlid

* Us Privacy and Coppa support
  • Loading branch information
bjorn-lw authored and stsepelin committed May 28, 2021
1 parent 29985d2 commit 1656396
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/livewrappedBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export const spec = {
version: VERSION,
gdprApplies: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.gdprApplies : undefined,
gdprConsent: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.consentString : undefined,
coppa: getCoppa(),
usPrivacy: bidderRequest.uspConsent,
cookieSupport: !utils.isSafariBrowser() && storage.cookiesAreEnabled(),
rcv: getAdblockerRecovered(),
adRequests: [...adRequests],
Expand Down Expand Up @@ -309,4 +311,9 @@ function getDeviceHeight() {
return window.innerHeight;
}

function getCoppa() {
if (typeof config.getConfig('coppa') === 'boolean') {
return config.getConfig('coppa');
}
}
registerBidder(spec);
73 changes: 73 additions & 0 deletions test/spec/modules/livewrappedBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,79 @@ describe('Livewrapped adapter tests', function () {
expect(data).to.deep.equal(expectedQuery);
});

it('should pass us privacy parameter', function() {
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
let testRequest = clone(bidderRequest);
testRequest.uspConsent = '1---';
let result = spec.buildRequests(testRequest.bids, testRequest);
let data = JSON.parse(result.data);

expect(result.url).to.equal('https://lwadm.com/ad');

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
publisherId: '26947112-2289-405D-88C1-A7340C57E63E',
userId: 'user id',
url: 'https://www.domain.com',
seats: {'dsp': ['seat 1']},
version: '1.4',
width: 100,
height: 100,
cookieSupport: true,
usPrivacy: '1---',
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
callerAdUnitId: 'panorama_d_1',
bidId: '2ffb201a808da7',
transactionId: '3D1C8CF7-D288-4D7F-8ADD-97C553056C3D',
formats: [{width: 980, height: 240}, {width: 980, height: 120}]
}]
};

expect(data).to.deep.equal(expectedQuery);
});

it('should pass coppa parameter', function() {
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);

let origGetConfig = config.getConfig;
sandbox.stub(config, 'getConfig').callsFake(function (key) {
if (key === 'coppa') {
return true;
}
return origGetConfig.apply(config, arguments);
});

let result = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = JSON.parse(result.data);

expect(result.url).to.equal('https://lwadm.com/ad');

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
publisherId: '26947112-2289-405D-88C1-A7340C57E63E',
userId: 'user id',
url: 'https://www.domain.com',
seats: {'dsp': ['seat 1']},
version: '1.4',
width: 100,
height: 100,
cookieSupport: true,
coppa: true,
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
callerAdUnitId: 'panorama_d_1',
bidId: '2ffb201a808da7',
transactionId: '3D1C8CF7-D288-4D7F-8ADD-97C553056C3D',
formats: [{width: 980, height: 240}, {width: 980, height: 120}]
}]
};

expect(data).to.deep.equal(expectedQuery);
});

it('should pass no cookie support', function() {
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => false);
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
Expand Down

0 comments on commit 1656396

Please sign in to comment.