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

[SENG-3488] #5

Closed
wants to merge 52 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d21b24c
First implementation of the AdRoll adapter (#1)
juanbono Oct 26, 2019
c180513
Fix request and bid id (#5)
raz-adroll Nov 21, 2019
b1c2753
Send Zone ID (#6)
abijr Nov 25, 2019
afdd359
Add age check before fastbid eval (#7)
abijr Dec 5, 2019
907e21e
Add date check (#8)
abijr Dec 6, 2019
17af86c
Merge remote-tracking branch 'upstream/master'
Dec 10, 2019
a77c8c9
Fix bidRequest validation (#9)
abijr Jan 14, 2020
215b573
Merge branch 'master' of github.com:Prebid/Prebid.js
Jan 14, 2020
e2fb8fd
Fix deprecated function usage (#10)
abijr Jan 16, 2020
5162fb0
[SENG-2757] remove custom function from adapter (#11)
juanbono Jan 22, 2020
e02ec0d
Handle nextroll id (#12)
abijr Jan 22, 2020
761ddcc
Rename adroll -> nextroll (#14)
abijr Jan 24, 2020
1b6bf69
Merge branch 'master' of github.com:Prebid/Prebid.js
Jan 24, 2020
9b1bd91
Rename fastbid -> pubtag functions and variables (#15)
abijr Jan 27, 2020
962664c
Merge branch 'master' of github.com:Prebid/Prebid.js
Jan 31, 2020
2a0a48b
Merge branch 'master' of github.com:Prebid/Prebid.js
Feb 4, 2020
413838f
Improve coverage of tests
Feb 4, 2020
154e8e1
Add docs
Feb 5, 2020
2532b0f
Add docs
Feb 6, 2020
5a4e64f
Merge pull request #1 from AdRoll/old-master
abijr Feb 6, 2020
8b96684
Merge pull request #2 from AdRoll/improve-coverage
abijr Feb 6, 2020
fb38274
Improve sizes and add sellerid
Feb 6, 2020
820aae4
Merge remote-tracking branch 'origin/master' into add-docs
Feb 6, 2020
eda56ba
Merge pull request #3 from AdRoll/add-docs
abijr Feb 6, 2020
a9b93dd
Add maintainer email
Feb 6, 2020
ceb3659
Fix CI problem
Feb 6, 2020
ca6c531
Merge branch 'master' of github.com:Prebid/Prebid.js
Feb 6, 2020
1781951
Fix IE tests
Feb 6, 2020
620e6d0
Replace second instance of find
Feb 6, 2020
dfa8fec
Fix types used in the doc
Feb 7, 2020
c0410ae
Remove unused fields in spec
Feb 10, 2020
0a6f4a3
Merge branch 'master' of github.com:Prebid/Prebid.js
Feb 10, 2020
0019d5c
Add ccpa support
Feb 13, 2020
54f90f4
Merge branch 'master' of github.com:Prebid/Prebid.js
Feb 14, 2020
783001d
Remove external script usage
Feb 17, 2020
fa47c78
Remove IP field
Feb 18, 2020
af2a312
Remove pubtag key
Feb 19, 2020
2422b53
Rename imports; Remove getUserSync function; Remove unused code; Use …
raz-adroll Feb 25, 2020
9fbbbe2
Adress comments
abijr Feb 25, 2020
80d5034
Merge branch 'master' of github.com:Prebid/Prebid.js
Mar 10, 2020
1346639
Add requests part
raz-adroll May 15, 2020
4bc412f
Address lint errors
raz-adroll May 15, 2020
2934508
Merge remote-tracking branch 'upstream/master' into SENG-3488
raz-adroll May 15, 2020
a9b393a
Remove parseUrl import
raz-adroll May 15, 2020
7a38aa7
Actually fix change in the already working response :facepalm:
raz-adroll May 15, 2020
95670d7
Merge remote-tracking branch 'upstream/master'
raz-adroll May 15, 2020
c5efaa0
Merge remote-tracking branch 'origin/master' into SENG-3488
raz-adroll May 15, 2020
28a36e4
Increase version; Send right object
raz-adroll May 18, 2020
2fee19f
Trying to add simple testing
raz-adroll May 18, 2020
618d616
Some changes
raz-adroll May 18, 2020
8776457
Title asset passes
raz-adroll May 18, 2020
27c03a1
Add some testing to native
raz-adroll May 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ccpa support
  • Loading branch information
Abimael Martinez committed Feb 13, 2020
commit 0019d5cbc4db0741116e4cedf11a27b6b499a174
28 changes: 25 additions & 3 deletions modules/nextrollBidAdapter.js
Original file line number Diff line number Diff line change
@@ -89,9 +89,13 @@ export const spec = {

function _buildRequests(validBidRequests, bidderRequest) {
let topLocation = _parseUrl(utils.deepAccess(bidderRequest, 'refererInfo.referer'));
let consent = hasCCPAConsent(bidderRequest);
return validBidRequests.map((bidRequest, index) => {
return {
method: 'POST',
options: {
withCredentials: consent,
},
url: BIDDER_ENDPOINT,
data: {
id: bidRequest.bidId,
@@ -250,9 +254,27 @@ function _parseUrl(url) {
};
}

/**
* @return {boolean}
*/
export function hasCCPAConsent(bidderRequest) {
if (typeof bidderRequest.uspConsent !== 'string') {
return true;
}
const usps = bidderRequest.uspConsent;
const version = usps[0];

// If we don't support the consent string, assume no-consent.
if (version !== '1' || usps.length < 3) {
return false;
}

const notice = usps[1];
const optOut = usps[2];

if (notice === 'N' || optOut === 'Y') {
return false;
}
return true;
}

export function tryGetPubtag() {
const hashPrefix = '// Hash: ';

45 changes: 44 additions & 1 deletion test/spec/modules/nextrollBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { spec, tryGetPubtag } from 'modules/nextrollBidAdapter';
import { spec, tryGetPubtag, hasCCPAConsent } from 'modules/nextrollBidAdapter';
import * as utils from 'src/utils';

const PUBTAG_LOCAL_STORAGE_KEY = 'nextroll_fast_bid';
@@ -57,6 +57,10 @@ describe('nextrollBidAdapter', function() {
expect(spec.buildRequests([validBid], {})[0].method).to.equal('POST');
});

it('builds a request with cookies method', function () {
expect(spec.buildRequests([validBid], {})[0].options.withCredentials).to.be.true;
});

it('builds a request with id, url and imp object', function () {
const request = spec.buildRequests([validBid], {})[0];
expect(request.data.id).to.be.an('string').that.is.not.empty;
@@ -228,4 +232,43 @@ describe('nextrollBidAdapter', function() {
utilsMock.verify();
});
});

describe('hasCCPAConsent', function() {
function ccpaRequest(consentString) {
return {
bidderCode: 'bidderX',
auctionId: 'e3a336ad-2222-4a1c-bbbb-ecc7c5554a34',
uspConsent: consentString
};
}

const noNoticeCases = ['1NYY', '1NNN', '1N--'];
noNoticeCases.forEach((ccpaString, index) => {
it(`No notice should indicate no consent (case ${index})`, function () {
const req = ccpaRequest(ccpaString);
expect(hasCCPAConsent(req)).to.be.false;
});
});

const noConsentCases = ['1YYY', '1YYN', '1YY-'];
noConsentCases.forEach((ccpaString, index) => {
it(`Opt-Out should indicate no consent (case ${index})`, function () {
const req = ccpaRequest(ccpaString);
expect(hasCCPAConsent(req)).to.be.false;
});
});

const consentCases = [undefined, '1YNY', '1YN-', '1Y--', '1---'];
consentCases.forEach((ccpaString, index) => {
it(`should indicate consent (case ${index})`, function() {
const req = ccpaRequest(ccpaString);
expect(hasCCPAConsent(req)).to.be.true;
})
});

it('builds a request with no credentials', function () {
const noConsent = ccpaRequest('1YYY');
expect(spec.buildRequests([validBid], noConsent)[0].options.withCredentials).to.be.false;
});
});
});