modules/adpod.js
function attachPriceIndustryDurationKeyToBid(bid, brandCategoryExclusion) {
  let initialCacheKey = bidCacheRegistry.getInitialCacheKey(bid);
  let duration = utils.deepAccess(bid, 'video.durationBucket');
  let cpmFixed = bid.cpm.toFixed(2);
  let pcd;

  if (brandCategoryExclusion) {
    let category = utils.deepAccess(bid, 'meta.adServerCatId');
    pcd = `${cpmFixed}_${category}_${duration}s`;
  } else {
    pcd = `${cpmFixed}_${duration}s`;
  }

  if (!bid.adserverTargeting) {
    bid.adserverTargeting = {};
  }
  bid.adserverTargeting[TARGETING_KEY_PB_CAT_DUR] = pcd;
  bid.adserverTargeting[TARGETING_KEY_CACHE_ID] = initialCacheKey;
  bid.videoCacheKey = initialCacheKey;
  bid.customCacheKey = `${pcd}_${initialCacheKey}`;
}
function attachPriceIndustryDurationKeyToBid(bid, brandCategoryExclusion) {
  let initialCacheKey = bidCacheRegistry.getInitialCacheKey(bid);
  let duration = utils.deepAccess(bid, 'video.durationBucket');
  let cpmFixed = bid.cpm.toFixed(2);
  let pcd;

  if (brandCategoryExclusion) {
    let category = utils.deepAccess(bid, 'meta.adServerCatId');
    pcd = `${cpmFixed}_${category}_${duration}s`;
  } else {
    pcd = `${cpmFixed}_${duration}s`;
  }

  if (!bid.adserverTargeting) {
    bid.adserverTargeting = {};
  }
  bid.adserverTargeting[TARGETING_KEY_PB_CAT_DUR] = pcd;
  bid.adserverTargeting[TARGETING_KEY_CACHE_ID] = initialCacheKey;
  bid.videoCacheKey = initialCacheKey;
  bid.customCacheKey = `${pcd}_${initialCacheKey}`;
}
function attachPriceIndustryDurationKeyToBid ( bid , brandCategoryExclusion ) { let initialCacheKey = bidCacheRegistry . getInitialCacheKey ( bid ) ; let duration = utils . deepAccess ( bid , 'video.durationBucket' ) ; let cpmFixed = bid . cpm . toFixed ( 2 ) ; let pcd ; if ( brandCategoryExclusion ) { let category = utils . deepAccess ( bid , 'meta.adServerCatId' ) ; pcd = ` ${ cpmFixed } ${ category } ${ duration } ` ; } else { pcd = ` ${ cpmFixed } ${ duration } ` ; } if ( ! bid . adserverTargeting ) { bid . adserverTargeting = { } ; } bid . adserverTargeting [ TARGETING_KEY_PB_CAT_DUR ] = pcd ; bid . adserverTargeting [ TARGETING_KEY_CACHE_ID ] = initialCacheKey ; bid . videoCacheKey = initialCacheKey ; bid . customCacheKey = ` ${ pcd } ${ initialCacheKey } ` ; }
This function reads certain fields from the bid to generate a specific key used for caching the bid in Prebid Cache
@param {Object} bid bid object to update
@param {Boolean} brandCategoryExclusion value read from setConfig; influences whether category is required or not
This function reads certain fields from the bid to generate a specific key used for caching the bid in Prebid Cache