From 3a8d0547fb41be0067706354432eb998b83e6b3a Mon Sep 17 00:00:00 2001 From: Manasi Moghe Date: Tue, 27 Nov 2018 12:18:38 +0530 Subject: [PATCH 1/2] changes to not show dctr message when none of the adunits have dctr set --- modules/pubmaticBidAdapter.js | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js index 7203cee2391..eb8a082f61f 100644 --- a/modules/pubmaticBidAdapter.js +++ b/modules/pubmaticBidAdapter.js @@ -449,29 +449,31 @@ export const spec = { payload.site.domain = _getDomainFromURL(payload.site.page); // set dctr value in site.ext, if present in validBidRequests[0], else ignore - if (validBidRequests[0].params.hasOwnProperty('dctr')) { - dctr = validBidRequests[0].params.dctr; - if (utils.isStr(dctr) && dctr.length > 0) { - var arr = dctr.split('|'); - dctr = ''; - arr.forEach(val => { - dctr += (val.length > 0) ? (val.trim() + '|') : ''; - }); - dctrLen = dctr.length; - if (dctr.substring(dctrLen, dctrLen - 1) === '|') { - dctr = dctr.substring(0, dctrLen - 1); + if (dctrArr.length > 0) { + if (validBidRequests[0].params.hasOwnProperty('dctr')) { + dctr = validBidRequests[0].params.dctr; + if (utils.isStr(dctr) && dctr.length > 0) { + var arr = dctr.split('|'); + dctr = ''; + arr.forEach(val => { + dctr += (val.length > 0) ? (val.trim() + '|') : ''; + }); + dctrLen = dctr.length; + if (dctr.substring(dctrLen, dctrLen - 1) === '|') { + dctr = dctr.substring(0, dctrLen - 1); + } + payload.site.ext = { + key_val: dctr.trim() + } + } else { + utils.logWarn(BIDDER_CODE + ': Ignoring param : dctr with value : ' + dctr + ', expects string-value, found empty or non-string value'); } - payload.site.ext = { - key_val: dctr.trim() + if (dctrArr.length > 1) { + utils.logWarn(BIDDER_CODE + ': dctr value found in more than 1 adunits. Value from 1st adunit will be picked. Ignoring values from subsequent adunits'); } } else { - utils.logWarn(BIDDER_CODE + ': Ignoring param : dctr with value : ' + dctr + ', expects string-value, found empty or non-string value'); - } - if (dctrArr.length > 1) { - utils.logWarn(BIDDER_CODE + ': dctr value found in more than 1 adunits. Value from 1st adunit will be picked. Ignoring values from subsequent adunits'); + utils.logWarn(BIDDER_CODE + ': dctr value not found in 1st adunit, ignoring values from subsequent adunits'); } - } else { - utils.logWarn(BIDDER_CODE + ': dctr value not found in 1st adunit, ignoring values from subsequent adunits'); } _handleEids(payload); From f000f82f771b33384b4c125bb7eb89a45db3f162 Mon Sep 17 00:00:00 2001 From: Manasi Moghe Date: Tue, 27 Nov 2018 15:58:04 +0530 Subject: [PATCH 2/2] added usage description for dctr and currency params --- modules/pubmaticBidAdapter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/pubmaticBidAdapter.md b/modules/pubmaticBidAdapter.md index 86d59d333f0..3f28d4586e7 100644 --- a/modules/pubmaticBidAdapter.md +++ b/modules/pubmaticBidAdapter.md @@ -33,8 +33,8 @@ var adUnits = [ kadpageurl: 'www.test.com', // optional gender: 'M', // optional kadfloor: '0.50', // optional - currency: 'AUD' // optional - dctr: 'key1=123|key2=345' // optional + currency: 'AUD' // optional (Value configured only in the 1st adunit will be passed on. < br/> Values if present in subsequent adunits, will be ignored.) + dctr: 'key1=123|key2=345' // optional (Value configured only in the 1st adunit will be passed on. < br/> Values if present in subsequent adunits, will be ignored.) } }] }];