From ebe25fb3da861c8a893026ca97e9e1840193a71a Mon Sep 17 00:00:00 2001 From: Zachary Lester Date: Sun, 9 Sep 2018 13:24:12 -0700 Subject: [PATCH] Fix #3059 by returning both hb_deal and hb_deal_${bidder_code} --- src/targeting.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/targeting.js b/src/targeting.js index d645a8ed20d..4bd3adbd9fc 100644 --- a/src/targeting.js +++ b/src/targeting.js @@ -259,9 +259,16 @@ export function newTargeting(auctionManager) { typeof winner.sendStandardTargeting === 'undefined' || winner.sendStandardTargeting || standardKeys.indexOf(key) === -1) - .map(key => ({ - [(key === 'hb_deal') ? `${key}_${winner.bidderCode}`.substring(0, MAX_DFP_KEYLENGTH) : key.substring(0, MAX_DFP_KEYLENGTH)]: [winner.adserverTargeting[key]] - })) + .reduce((acc, key) => { + const targetingValue = [winner.adserverTargeting[key]]; + const targeting = { [key.substring(0, MAX_DFP_KEYLENGTH)]: targetingValue }; + if (key === 'hb_deal') { + const bidderCodeTargetingKey = `${key}_${winner.bidderCode}`.substring(0, MAX_DFP_KEYLENGTH); + const bidderCodeTargeting = { [bidderCodeTargetingKey]: targetingValue }; + return [...acc, targeting, bidderCodeTargeting]; + } + return [...acc, targeting]; + }, []) }; });