Skip to content

Commit

Permalink
support pubcid and uids (prebid#4143)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlosinski authored and sa1omon committed Nov 28, 2019
1 parent b32aed6 commit 98a174c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/justpremiumBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerBidder } from '../src/adapters/bidderFactory'
import { deepAccess } from '../src/utils';

const BIDDER_CODE = 'justpremium'
const ENDPOINT_URL = '//pre.ads.justpremium.com/v/2.0/t/xhr'
Expand Down Expand Up @@ -46,6 +47,14 @@ export const spec = {
sizes[zone].push.apply(sizes[zone], b.sizes)
})

if (deepAccess(validBidRequests[0], 'userId.pubcid')) {
payload.pubcid = deepAccess(validBidRequests[0], 'userId.pubcid')
} else if (deepAccess(validBidRequests[0], 'crumbs.pubcid')) {
payload.pubcid = deepAccess(validBidRequests[0], 'crumbs.pubcid')
}

payload.uids = validBidRequests[0].userId

if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr_consent = {
consent_string: bidderRequest.gdprConsent.consentString,
Expand Down
16 changes: 16 additions & 0 deletions test/spec/modules/justpremiumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ describe('justpremium adapter', function () {
{
adUnitCode: 'div-gpt-ad-1471513102552-1',
bidder: 'justpremium',
crumbs: {
pubcid: '0000000'
},
userId: {
tdid: '1111111',
id5id: '2222222',
digitrustid: {
data: {
id: '3333333'
}
}
},
params: {
zone: 28313,
allow: ['lb', 'wp']
Expand Down Expand Up @@ -71,6 +83,10 @@ describe('justpremium adapter', function () {
expect(jpxRequest.sizes).to.not.equal('undefined')
expect(jpxRequest.version.prebid).to.equal('$prebid.version$')
expect(jpxRequest.version.jp_adapter).to.equal('1.4')
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')
})
})

Expand Down

0 comments on commit 98a174c

Please sign in to comment.