Skip to content

Add hb_uuid and hb_cache_id back to dfp module #3668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/dfpAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ 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 },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment here with a link to the issue so folks looking at the code will understand?

// hb_uuid will be deprecated and replaced by hb_cache_id
{ hb_cache_id: bid && bid.videoCacheKey },
allTargetingData,
adserverTargeting,
optCustParams,
Expand Down
40 changes: 40 additions & 0 deletions test/spec/modules/dfpAdServerVideo_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});