Skip to content
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

Always use standard KVP. #262

Closed
wants to merge 4 commits into from
Closed
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
10 changes: 7 additions & 3 deletions src/bidmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ exports.getKeyValueTargetingPairs = function (bidderCode, custBidObj) {
custBidObj.alwaysUseBid = defaultBidderSettingsMap[bidderCode].alwaysUseBid;
}

//3) set the keys from "standard" setting or from prebid defaults
else if (custBidObj && bidder_settings) {
//3) always set the keys from "standard" setting or from prebid defaults
if (custBidObj && bidder_settings) {
if (!bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD]) {
bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD] = {
adserverTargeting: [
Expand Down Expand Up @@ -265,11 +265,15 @@ function setKeys(keyValues, bidderSettings, custBidObj) {
var key = kvPair.key;
var value = kvPair.val;

if (keyValues[key]) {
utils.logMessage('Warning setting keys (overwriting existing KVP)', 'bidmanager.js', key, keyValues[key], value);
}

if (utils.isFn(value)) {
try {
keyValues[key] = value(custBidObj);
} catch (e) {
utils.logError('bidmanager', 'ERROR', e);
utils.logError('Error setting keys (failed to evaluate value function)', 'bidmanager.js', e);
}
} else {
keyValues[key] = value;
Expand Down
6 changes: 4 additions & 2 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ function buildBidResponse(bidArray) {
if (bid.alwaysUseBid && bidClone.adserverTargeting) { // add the bid if alwaysUse and bid has returned
// push key into targeting
pb_targetingMap[bidClone.adUnitCode] = utils.extend(pb_targetingMap[bidClone.adUnitCode], bidClone.adserverTargeting);
} else if (bid.cpm && bid.cpm > 0) {
//else put into auction array if cpm > 0
}

if (bid.cpm && bid.cpm > 0) {
// put into auction array if cpm > 0
bidArrayTargeting.push({
cpm: bid.cpm,
bid: bid
Expand Down