From ccfb4494774c87daff7fd74e5127f9a65fe25b83 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Wed, 7 Feb 2018 11:42:08 -0700 Subject: [PATCH 1/2] omit app and device if not present rather than send false --- modules/prebidServerBidAdapter.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index e222ecb446b..114768614c0 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -234,13 +234,19 @@ export function PrebidServer() { url: utils.getTopWindowUrl(), prebid_version: '$prebid.version$', ad_units: adUnits.filter(hasSizes), - is_debug: isDebug, - device: device, - app: app + is_debug: isDebug }; let digiTrust = _getDigiTrustQueryParams(); + if (device) { + requestJson.device = device; + } + + if (app) { + requestJson.app = app; + } + if (digiTrust) { requestJson.digiTrust = digiTrust; } From 5d59dd409893b0e2a4727541f8f13d89744f2ab5 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Wed, 7 Feb 2018 11:56:37 -0700 Subject: [PATCH 2/2] no bang bang! just get and set on request if object --- modules/prebidServerBidAdapter.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index 114768614c0..7ef83240251 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -210,8 +210,6 @@ export function PrebidServer() { /* Prebid executes this function when the page asks to send out bid requests */ baseAdapter.callBids = function(s2sBidRequest, bidRequests, addBidResponse, done, ajax) { const isDebug = !!getConfig('debug'); - const app = !!getConfig('app'); - const device = !!getConfig('device'); const adUnits = utils.deepClone(s2sBidRequest.ad_units); adUnits.forEach(adUnit => { let videoMediaType = utils.deepAccess(adUnit, 'mediaTypes.video'); @@ -239,13 +237,13 @@ export function PrebidServer() { let digiTrust = _getDigiTrustQueryParams(); - if (device) { - requestJson.device = device; - } - - if (app) { - requestJson.app = app; - } + // grab some global config and pass it along + ['app', 'device'].forEach(setting => { + let value = getConfig(setting); + if (typeof value === 'object') { + requestJson[setting] = value; + } + }); if (digiTrust) { requestJson.digiTrust = digiTrust;