Skip to content

Commit

Permalink
adxcgBidAdapter - added pubcid (prebid#3824)
Browse files Browse the repository at this point in the history
* adxcgBidAdapter - added pubcid

* mini fix

* Update adxcgBidAdapter

Added minimal change to restart CI process

* added passing tdid, updated pubcid

* unit test for userid support - pubcid, tdid

* Update adxcgBidAdapter.js

just to restart CircleCI

* Update adxcgBidAdapter.js 

just to restart CircleCI
  • Loading branch information
adxcgcom authored and Alex committed Aug 1, 2019
1 parent 1216d91 commit a1b4f6d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import includes from 'core-js/library/fn/array/includes'
* updated for gdpr compliance on 2018.05.22 -requires gdpr compliance module
* updated to pass aditional auction and impression level parameters. added pass for video targeting parameters
* updated to fix native support for image width/height and icon 2019.03.17
* updated support for userid - pubcid,ttid 2019.05.28
*/

const BIDDER_CODE = 'adxcg'
Expand Down Expand Up @@ -159,6 +160,14 @@ export const spec = {
beaconParams.prebidBidIds = prebidBidIds.join(',')
beaconParams.bidfloors = bidfloors.join(',')

if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.pubcid'))) {
beaconParams.pubcid = validBidRequests[0].userId.pubcid;
}

if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.tdid'))) {
beaconParams.tdid = validBidRequests[0].userId.tdid;
}

let adxcgRequestUrl = url.format({
protocol: secure ? 'https' : 'http',
hostname: secure ? 'hbps.adxcg.net' : 'hbp.adxcg.net',
Expand Down
50 changes: 50 additions & 0 deletions test/spec/modules/adxcgBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,56 @@ describe('AdxcgAdapter', function () {
})
})

describe('userid pubcid should be passed to querystring', function () {
let bid = [{
'bidder': 'adxcg',
'params': {
'adzoneid': '1'
},
'adUnitCode': 'adunit-code',
'sizes': [[300, 250], [640, 360], [1, 1]],
'bidId': '84ab500420319d',
'bidderRequestId': '7101db09af0db2',
'auctionId': '1d1a030790a475',
}]

let bidderRequests = {};

bid[0].userId = {'pubcid': 'pubcidabcd'};

it('should send pubcid if available', function () {
let request = spec.buildRequests(bid, bidderRequests)
let parsedRequestUrl = url.parse(request.url)
let query = parsedRequestUrl.search
expect(query.pubcid).to.equal('pubcidabcd')
})
})

describe('userid tdid should be passed to querystring', function () {
let bid = [{
'bidder': 'adxcg',
'params': {
'adzoneid': '1'
},
'adUnitCode': 'adunit-code',
'sizes': [[300, 250], [640, 360], [1, 1]],
'bidId': '84ab500420319d',
'bidderRequestId': '7101db09af0db2',
'auctionId': '1d1a030790a475',
}]

let bidderRequests = {};

bid[0].userId = {'tdid': 'tdidabcd'};

it('should send pubcid if available', function () {
let request = spec.buildRequests(bid, bidderRequests)
let parsedRequestUrl = url.parse(request.url)
let query = parsedRequestUrl.search
expect(query.tdid).to.equal('tdidabcd');
})
})

describe('response handler', function () {
let BIDDER_REQUEST = {
'bidder': 'adxcg',
Expand Down

0 comments on commit a1b4f6d

Please sign in to comment.