Skip to content

Commit

Permalink
jpBidAdapter - pass additional param in request (#8188)
Browse files Browse the repository at this point in the history
Tests updated

Bump version to 1.8.2
  • Loading branch information
marcin15g authored Mar 25, 2022
1 parent 4ec2cbb commit 64bd041
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
21 changes: 19 additions & 2 deletions modules/justpremiumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { deepAccess } from '../src/utils.js';
const BIDDER_CODE = 'justpremium'
const GVLID = 62
const ENDPOINT_URL = 'https://pre.ads.justpremium.com/v/2.0/t/xhr'
const JP_ADAPTER_VERSION = '1.8.1'
const JP_ADAPTER_VERSION = '1.8.2'
const pixels = []

export const spec = {
Expand All @@ -19,6 +19,7 @@ export const spec = {
buildRequests: (validBidRequests, bidderRequest) => {
const c = preparePubCond(validBidRequests)
const dim = getWebsiteDim()
const ggExt = getGumGumParams()
const payload = {
zone: validBidRequests.map(b => {
return parseInt(b.params.zone)
Expand All @@ -32,7 +33,8 @@ export const spec = {
wh: dim.innerHeight,
c: c,
id: validBidRequests[0].params.zone,
sizes: {}
sizes: {},
ggExt: ggExt
}
validBidRequests.forEach(b => {
const zone = b.params.zone
Expand Down Expand Up @@ -253,4 +255,19 @@ function getWebsiteDim () {
}
}

function getGumGumParams () {
if (!window.top) return null

const urlParams = new URLSearchParams(window.top.location.search)
const ggParams = {
'ggAdbuyid': urlParams.get('gg_adbuyid'),
'ggDealid': urlParams.get('gg_dealid'),
'ggEadbuyid': urlParams.get('gg_eadbuyid')
}

const checkIfEmpty = (obj) => Object.keys(obj).length === 0 ? null : obj
const removeNullEntries = (obj) => Object.fromEntries(Object.entries(obj).filter(([_, v]) => v != null))
return checkIfEmpty(removeNullEntries(ggParams))
}

registerBidder(spec)
3 changes: 2 additions & 1 deletion test/spec/modules/justpremiumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ 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.8.1')
expect(jpxRequest.version.jp_adapter).to.equal('1.8.2')
expect(jpxRequest.pubcid).to.equal('0000000')
expect(jpxRequest.uids.tdid).to.equal('1111111')
expect(jpxRequest.uids.id5id.uid).to.equal('2222222')
expect(jpxRequest.uids.digitrustid.data.id).to.equal('3333333')
expect(jpxRequest.us_privacy).to.equal('1YYN')
expect(jpxRequest.ggExt).to.be.null
})
})

Expand Down

0 comments on commit 64bd041

Please sign in to comment.