Skip to content

Commit

Permalink
Improve Digital: CCPA support (#4828)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbartek25 authored Feb 10, 2020
1 parent 659b23c commit c24e8e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes';
const BIDDER_CODE = 'improvedigital';

export const spec = {
version: '6.0.1',
version: '6.1.0',
code: BIDDER_CODE,
aliases: ['id'],
supportedMediaTypes: [BANNER, NATIVE, VIDEO],
Expand Down Expand Up @@ -43,6 +43,10 @@ export const spec = {
requestParameters.gdpr = bidderRequest.gdprConsent.consentString;
}

if (bidderRequest && bidderRequest.uspConsent) {
requestParameters.usPrivacy = bidderRequest.uspConsent;
}

if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
requestParameters.referrer = bidderRequest.refererInfo.referer;
}
Expand Down Expand Up @@ -343,7 +347,7 @@ export function ImproveDigitalAdServerJSClient(endPoint) {
AD_SERVER_BASE_URL: 'ice.360yield.com',
END_POINT: endPoint || 'hb',
AD_SERVER_URL_PARAM: 'jsonp=',
CLIENT_VERSION: 'JS-6.2.0',
CLIENT_VERSION: 'JS-6.3.0',
MAX_URL_LENGTH: 2083,
ERROR_CODES: {
MISSING_PLACEMENT_PARAMS: 2,
Expand Down Expand Up @@ -497,6 +501,9 @@ export function ImproveDigitalAdServerJSClient(endPoint) {
if (requestParameters.gdpr || requestParameters.gdpr === 0) {
impressionBidRequestObject.gdpr = requestParameters.gdpr;
}
if (requestParameters.usPrivacy) {
impressionBidRequestObject.us_privacy = requestParameters.usPrivacy;
}
if (requestParameters.schain) {
impressionBidRequestObject.schain = requestParameters.schain;
}
Expand Down
9 changes: 9 additions & 0 deletions test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ describe('Improve Digital Adapter Tests', function () {
expect(params.bid_request).to.be.an('object');
expect(params.bid_request.id).to.be.a('string');
expect(params.bid_request.version).to.equal(`${spec.version}-${idClient.CONSTANTS.CLIENT_VERSION}`);
expect(params.bid_request.gdpr).to.not.exist;
expect(params.bid_request.us_privacy).to.not.exist;
expect(params.bid_request.imp).to.deep.equal([
{
id: '33e9500b21129f',
Expand Down Expand Up @@ -186,6 +188,13 @@ describe('Improve Digital Adapter Tests', function () {
expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==');
});

it('should add CCPA consent string', function () {
const bidRequest = Object.assign({}, simpleBidRequest);
const request = spec.buildRequests([bidRequest], { uspConsent: '1YYY' })[0];
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
expect(params.bid_request.us_privacy).to.equal('1YYY');
});

it('should add referrer', function () {
const bidRequest = Object.assign({}, simpleBidRequest);
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
Expand Down

0 comments on commit c24e8e1

Please sign in to comment.