Skip to content

Commit

Permalink
support for us privacy (CCPA) (#4665)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlosinski authored and Mike Chowla committed Dec 30, 2019
1 parent 5ba6ea9 commit 6a57738
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions modules/justpremiumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { deepAccess } from '../src/utils';

const BIDDER_CODE = 'justpremium'
const ENDPOINT_URL = 'https://pre.ads.justpremium.com/v/2.0/t/xhr'
const JP_ADAPTER_VERSION = '1.6'
const JP_ADAPTER_VERSION = '1.7'
const pixels = []

export const spec = {
Expand Down Expand Up @@ -54,6 +54,10 @@ export const spec = {
}
}

if (bidderRequest && bidderRequest.uspConsent) {
payload.us_privacy = bidderRequest.uspConsent
}

payload.version = {
prebid: '$prebid.version$',
jp_adapter: JP_ADAPTER_VERSION
Expand Down Expand Up @@ -94,11 +98,14 @@ export const spec = {
return bidResponses
},

getUserSyncs: function getUserSyncs(syncOptions, responses, gdprConsent) {
getUserSyncs: function getUserSyncs(syncOptions, responses, gdprConsent, uspConsent) {
let url = 'https://pre.ads.justpremium.com/v/1.0/t/sync' + '?_c=' + 'a' + Math.random().toString(36).substring(7) + Date.now();
if (gdprConsent && (typeof gdprConsent.gdprApplies === 'boolean')) {
url = url + '&consentString=' + encodeURIComponent(gdprConsent.consentString)
}
if (uspConsent) {
url = url + '&usPrivacy=' + encodeURIComponent(uspConsent)
}
if (syncOptions.iframeEnabled) {
pixels.push({
type: 'iframe',
Expand Down
8 changes: 6 additions & 2 deletions test/spec/modules/justpremiumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('justpremium adapter', function () {
]

let bidderRequest = {
uspConsent: '1YYN',
refererInfo: {
referer: 'https://justpremium.com'
}
Expand Down Expand Up @@ -80,11 +81,12 @@ describe('justpremium adapter', function () {
expect(jpxRequest.id).to.equal(adUnits[0].params.zone)
expect(jpxRequest.mediaTypes && jpxRequest.mediaTypes.banner && jpxRequest.mediaTypes.banner.sizes).to.not.equal('undefined')
expect(jpxRequest.version.prebid).to.equal('$prebid.version$')
expect(jpxRequest.version.jp_adapter).to.equal('1.6')
expect(jpxRequest.version.jp_adapter).to.equal('1.7')
expect(jpxRequest.pubcid).to.equal('0000000')
expect(jpxRequest.uids.tdid).to.equal('1111111')
expect(jpxRequest.uids.id5id).to.equal('2222222')
expect(jpxRequest.uids.digitrustid.data.id).to.equal('3333333')
expect(jpxRequest.us_privacy).to.equal('1YYN')
})
})

Expand Down Expand Up @@ -155,10 +157,12 @@ describe('justpremium adapter', function () {

describe('getUserSyncs', function () {
it('Verifies sync options', function () {
const options = spec.getUserSyncs({iframeEnabled: true})
const options = spec.getUserSyncs({iframeEnabled: true}, {}, {gdprApplies: true, consentString: 'BOOgjO9OOgjO9APABAENAi-AAAAWd'}, '1YYN')
expect(options).to.not.be.undefined
expect(options[0].type).to.equal('iframe')
expect(options[0].url).to.match(/\/\/pre.ads.justpremium.com\/v\/1.0\/t\/sync/)
expect(options[0].url).to.match(/&consentString=BOOgjO9OOgjO9APABAENAi-AAAAWd/)
expect(options[0].url).to.match(/&usPrivacy=1YYN/)
})
})
})

0 comments on commit 6a57738

Please sign in to comment.