Skip to content

Commit

Permalink
Modified how gdpr info is being sent from adapter (#3253)
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
  • Loading branch information
bjorn-lw authored and idettman committed Nov 6, 2018
1 parent 6456231 commit ec47ed0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 20 deletions.
4 changes: 2 additions & 2 deletions modules/livewrappedBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { config } from 'src/config';
import find from 'core-js/library/fn/array/find';

const BIDDER_CODE = 'livewrapped';
export const URL = 'https://lwadm.com/ad';
export const URL = '//lwadm.com/ad';
const VERSION = '1.1';

export const spec = {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const spec = {
ifa: ifa ? ifa.params.ifa : undefined,
tid: tid ? tid.params.tid : undefined,
version: VERSION,
gdprApplies: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.gdprApplies : false,
gdprApplies: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.gdprApplies : undefined,
gdprConsent: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.consentString : undefined,
cookieSupport: !utils.isSafariBrowser() && utils.cookiesAreEnabled(),
adRequests: [...adRequests]
Expand Down
60 changes: 42 additions & 18 deletions test/spec/modules/livewrappedBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
Expand All @@ -101,7 +101,6 @@ describe('Livewrapped adapter tests', function () {
seats: {'dsp': ['seat 1']},
version: '1.1',
cookieSupport: true,
gdprApplies: false,
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
callerAdUnitId: 'panorama_d_1',
Expand All @@ -127,7 +126,7 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(multiplebidRequest.bids, multiplebidRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
Expand All @@ -137,7 +136,6 @@ describe('Livewrapped adapter tests', function () {
seats: {'dsp': ['seat 1']},
version: '1.1',
cookieSupport: true,
gdprApplies: false,
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
callerAdUnitId: 'panorama_d_1',
Expand All @@ -164,7 +162,7 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
Expand All @@ -174,7 +172,6 @@ describe('Livewrapped adapter tests', function () {
seats: {'dsp': ['seat 1']},
version: '1.1',
cookieSupport: true,
gdprApplies: false,
adRequests: [{
callerAdUnitId: 'caller id 1',
bidId: '2ffb201a808da7',
Expand All @@ -196,15 +193,14 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
publisherId: '26947112-2289-405D-88C1-A7340C57E63E',
url: 'http://www.domain.com',
version: '1.1',
cookieSupport: true,
gdprApplies: false,
adRequests: [{
callerAdUnitId: 'panorama_d_1',
bidId: '2ffb201a808da7',
Expand All @@ -226,14 +222,13 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
url: 'http://www.domain.com',
version: '1.1',
cookieSupport: true,
gdprApplies: false,
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
callerAdUnitId: 'panorama_d_1',
Expand Down Expand Up @@ -266,7 +261,6 @@ describe('Livewrapped adapter tests', function () {
deviceId: 'deviceid',
ifa: 'ifa',
cookieSupport: true,
gdprApplies: false,
adRequests: [{
callerAdUnitId: 'panorama_d_1',
bidId: '2ffb201a808da7',
Expand Down Expand Up @@ -298,7 +292,6 @@ describe('Livewrapped adapter tests', function () {
tid: 'tracking id',
test: true,
cookieSupport: true,
gdprApplies: false,
adRequests: [{
callerAdUnitId: 'panorama_d_1',
bidId: '2ffb201a808da7',
Expand All @@ -310,7 +303,7 @@ describe('Livewrapped adapter tests', function () {
expect(data).to.deep.equal(expectedQuery);
});

it('should pass gdpr parameters', function() {
it('should pass gdpr true parameters', function() {
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
sandbox.stub(utils, 'cookiesAreEnabled').callsFake(() => true);
let testRequest = clone(bidderRequest);
Expand All @@ -321,7 +314,7 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(testRequest.bids, testRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
Expand All @@ -345,13 +338,46 @@ describe('Livewrapped adapter tests', function () {
expect(data).to.deep.equal(expectedQuery);
});

it('should pass gdpr false parameters', function() {
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
sandbox.stub(utils, 'cookiesAreEnabled').callsFake(() => true);
let testRequest = clone(bidderRequest);
testRequest.gdprConsent = {
gdprApplies: false
};
let result = spec.buildRequests(testRequest.bids, testRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
publisherId: '26947112-2289-405D-88C1-A7340C57E63E',
userId: 'user id',
url: 'http://www.domain.com',
seats: {'dsp': ['seat 1']},
version: '1.1',
cookieSupport: true,
gdprApplies: false,
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(utils, 'cookiesAreEnabled').callsFake(() => false);
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
let result = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
Expand All @@ -360,7 +386,6 @@ describe('Livewrapped adapter tests', function () {
url: 'http://www.domain.com',
seats: {'dsp': ['seat 1']},
version: '1.1',
gdprApplies: false,
cookieSupport: false,
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
Expand All @@ -380,7 +405,7 @@ describe('Livewrapped adapter tests', function () {
let result = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = JSON.parse(result.data);

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

let expectedQuery = {
auctionId: 'F7557995-65F5-4682-8782-7D5D34D82A8C',
Expand All @@ -389,7 +414,6 @@ describe('Livewrapped adapter tests', function () {
url: 'http://www.domain.com',
seats: {'dsp': ['seat 1']},
version: '1.1',
gdprApplies: false,
cookieSupport: false,
adRequests: [{
adUnitId: '9E153CED-61BC-479E-98DF-24DC0D01BA37',
Expand Down

0 comments on commit ec47ed0

Please sign in to comment.