From 78ae2182a5cd12b3e96a73267be47e6130986de4 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Fri, 22 Mar 2019 12:51:59 -0400 Subject: [PATCH 1/2] Add hb_uuid and hb_cache_id back to module --- modules/dfpAdServerVideo.js | 3 ++ test/spec/modules/dfpAdServerVideo_spec.js | 40 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/modules/dfpAdServerVideo.js b/modules/dfpAdServerVideo.js index 17a8f0f1144..5f5f7a49243 100644 --- a/modules/dfpAdServerVideo.js +++ b/modules/dfpAdServerVideo.js @@ -158,6 +158,9 @@ function getCustParams(bid, options) { const optCustParams = deepAccess(options, 'params.cust_params'); let customParams = Object.assign({}, + { hb_uuid: bid && bid.videoCacheKey }, + // hb_uuid will be deprecated and replaced by hb_cache_id + { hb_cache_id: bid && bid.videoCacheKey }, allTargetingData, adserverTargeting, optCustParams, diff --git a/test/spec/modules/dfpAdServerVideo_spec.js b/test/spec/modules/dfpAdServerVideo_spec.js index ab988ec0fe3..30cf91c2e17 100644 --- a/test/spec/modules/dfpAdServerVideo_spec.js +++ b/test/spec/modules/dfpAdServerVideo_spec.js @@ -256,4 +256,44 @@ describe('The DFP video support module', function () { expect(url).to.be.a('string'); }); + + it('should include hb_uuid and hb_cache_id in cust_params when both keys are exluded from overwritten bidderSettings', function () { + const bidCopy = utils.deepClone(bid); + delete bidCopy.adserverTargeting.hb_uuid; + delete bidCopy.adserverTargeting.hb_cache_id; + + const url = parse(buildDfpVideoUrl({ + adUnit: adUnit, + bid: bidCopy, + params: { + 'iu': 'my/adUnit' + } + })); + const queryObject = parseQS(url.query); + const customParams = parseQS('?' + decodeURIComponent(queryObject.cust_params)); + + expect(customParams).to.have.property('hb_uuid', bid.videoCacheKey); + expect(customParams).to.have.property('hb_cache_id', bid.videoCacheKey); + }); + + it('should include hb_uuid and hb_cache_id in cust params from overwritten standard bidderSettings', function () { + const bidCopy = utils.deepClone(bid); + bidCopy.adserverTargeting = Object.assign(bidCopy.adserverTargeting, { + hb_uuid: 'def', + hb_cache_id: 'def' + }); + + const url = parse(buildDfpVideoUrl({ + adUnit: adUnit, + bid: bidCopy, + params: { + 'iu': 'my/adUnit' + } + })); + const queryObject = parseQS(url.query); + const customParams = parseQS('?' + decodeURIComponent(queryObject.cust_params)); + + expect(customParams).to.have.property('hb_uuid', 'def'); + expect(customParams).to.have.property('hb_cache_id', 'def'); + }); }); From 5bcbb22dba2416280559c46033af2a6d528fa5fe Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Mon, 25 Mar 2019 11:59:49 -0400 Subject: [PATCH 2/2] added comment --- modules/dfpAdServerVideo.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/dfpAdServerVideo.js b/modules/dfpAdServerVideo.js index 5f5f7a49243..d8cd6e099ee 100644 --- a/modules/dfpAdServerVideo.js +++ b/modules/dfpAdServerVideo.js @@ -158,6 +158,7 @@ function getCustParams(bid, options) { const optCustParams = deepAccess(options, 'params.cust_params'); let customParams = Object.assign({}, + // Why are we adding standard keys here ? Refer https://github.com/prebid/Prebid.js/issues/3664 { hb_uuid: bid && bid.videoCacheKey }, // hb_uuid will be deprecated and replaced by hb_cache_id { hb_cache_id: bid && bid.videoCacheKey },