Skip to content

Commit 48172be

Browse files
authored
Revert "fix two issues related to hb_uuid and hb_cache_id targeting keys (#3568)" (#3595)
This reverts commit 54b4188.
1 parent 54b4188 commit 48172be

File tree

3 files changed

+23
-33
lines changed

3 files changed

+23
-33
lines changed

modules/dfpAdServerVideo.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ function getCustParams(bid, options) {
160160
let customParams = Object.assign({},
161161
allTargetingData,
162162
adserverTargeting,
163+
{ hb_uuid: bid && bid.videoCacheKey },
164+
// hb_uuid will be deprecated and replaced by hb_cache_id
165+
{ hb_cache_id: bid && bid.videoCacheKey },
163166
optCustParams,
164167
);
165168
return encodeURIComponent(formatQS(customParams));

src/auction.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,6 @@ export function doCallbacksIfTimedout(auctionInstance, bidResponse) {
386386

387387
// Add a bid to the auction.
388388
export function addBidToAuction(auctionInstance, bidResponse) {
389-
setupBidTargeting(bidResponse);
390-
391389
events.emit(CONSTANTS.EVENTS.BID_RESPONSE, bidResponse);
392390
auctionInstance.addBidReceived(bidResponse);
393391

@@ -431,7 +429,6 @@ export const callPrebidCache = hook('async', function(auctionInstance, bidRespon
431429
doCallbacksIfTimedout(auctionInstance, bidResponse);
432430
} else {
433431
bidResponse.videoCacheKey = cacheIds[0].uuid;
434-
435432
if (!bidResponse.vastUrl) {
436433
bidResponse.vastUrl = getCacheUrl(bidResponse.videoCacheKey);
437434
}
@@ -488,23 +485,16 @@ function getPreparedBidForAuction({adUnitCode, bid, bidderRequest, auctionId}) {
488485
bidObject.pbDg = priceStringsObj.dense;
489486
bidObject.pbCg = priceStringsObj.custom;
490487

491-
return bidObject;
492-
}
493-
494-
function setupBidTargeting(bidObject) {
495-
let keyValues;
488+
// if there is any key value pairs to map do here
489+
var keyValues;
496490
if (bidObject.bidderCode && (bidObject.cpm > 0 || bidObject.dealId)) {
497491
keyValues = getKeyValueTargetingPairs(bidObject.bidderCode, bidObject, bidReq);
498492
}
499493

500-
let cacheTargetKeys = {};
501-
if (bidObject.videoCacheKey) {
502-
cacheTargetKeys.hb_uuid = bidObject.videoCacheKey;
503-
cacheTargetKeys.hb_cache_id = bidObject.videoCacheKey;
504-
}
505-
506494
// use any targeting provided as defaults, otherwise just set from getKeyValueTargetingPairs
507-
bidObject.adserverTargeting = Object.assign(bidObject.adserverTargeting || {}, cacheTargetKeys, keyValues);
495+
bidObject.adserverTargeting = Object.assign(bidObject.adserverTargeting || {}, keyValues);
496+
497+
return bidObject;
508498
}
509499

510500
export function getStandardBidderSettings(mediaType) {

test/spec/modules/dfpAdServerVideo_spec.js

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import { targeting } from 'src/targeting';
1010

1111
const bid = {
1212
videoCacheKey: 'abc',
13-
adserverTargeting: {
14-
hb_uuid: 'abc',
15-
hb_cache_id: 'abc',
16-
},
13+
adserverTargeting: { },
1714
};
1815

1916
describe('The DFP video support module', function () {
@@ -43,7 +40,7 @@ describe('The DFP video support module', function () {
4340
});
4441

4542
it('can take an adserver url as a parameter', function () {
46-
const bidCopy = utils.deepClone(bid);
43+
const bidCopy = Object.assign({ }, bid);
4744
bidCopy.vastUrl = 'vastUrl.example';
4845

4946
const url = parse(buildDfpVideoUrl({
@@ -93,10 +90,10 @@ describe('The DFP video support module', function () {
9390
});
9491

9592
it('should include the cache key and adserver targeting in cust_params', function () {
96-
const bidCopy = utils.deepClone(bid);
97-
bidCopy.adserverTargeting = Object.assign(bidCopy.adserverTargeting, {
93+
const bidCopy = Object.assign({ }, bid);
94+
bidCopy.adserverTargeting = {
9895
hb_adid: 'ad_id',
99-
});
96+
};
10097

10198
const url = parse(buildDfpVideoUrl({
10299
adUnit: adUnit,
@@ -163,10 +160,10 @@ describe('The DFP video support module', function () {
163160
}
164161
});
165162

166-
const bidCopy = utils.deepClone(bid);
167-
bidCopy.adserverTargeting = Object.assign(bidCopy.adserverTargeting, {
163+
const bidCopy = Object.assign({ }, bid);
164+
bidCopy.adserverTargeting = {
168165
hb_adid: 'ad_id',
169-
});
166+
};
170167

171168
const url = parse(buildDfpVideoUrl({
172169
adUnit: adUnitsCopy,
@@ -187,10 +184,10 @@ describe('The DFP video support module', function () {
187184
});
188185

189186
it('should merge the user-provided cust_params with the default ones', function () {
190-
const bidCopy = utils.deepClone(bid);
191-
bidCopy.adserverTargeting = Object.assign(bidCopy.adserverTargeting, {
187+
const bidCopy = Object.assign({ }, bid);
188+
bidCopy.adserverTargeting = {
192189
hb_adid: 'ad_id',
193-
});
190+
};
194191

195192
const url = parse(buildDfpVideoUrl({
196193
adUnit: adUnit,
@@ -210,10 +207,10 @@ describe('The DFP video support module', function () {
210207
});
211208

212209
it('should merge the user-provided cust-params with the default ones when using url object', function () {
213-
const bidCopy = utils.deepClone(bid);
214-
bidCopy.adserverTargeting = Object.assign(bidCopy.adserverTargeting, {
210+
const bidCopy = Object.assign({ }, bid);
211+
bidCopy.adserverTargeting = {
215212
hb_adid: 'ad_id',
216-
});
213+
};
217214

218215
const url = parse(buildDfpVideoUrl({
219216
adUnit: adUnit,
@@ -232,7 +229,7 @@ describe('The DFP video support module', function () {
232229
});
233230

234231
it('should not overwrite an existing description_url for object input and cache disabled', function () {
235-
const bidCopy = utils.deepClone(bid);
232+
const bidCopy = Object.assign({}, bid);
236233
bidCopy.vastUrl = 'vastUrl.example';
237234

238235
const url = parse(buildDfpVideoUrl({

0 commit comments

Comments
 (0)