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

Targeting updates #1689

Merged
merged 14 commits into from
Nov 29, 2017
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
1 change: 0 additions & 1 deletion src/auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ export function getKeyValueTargetingPairs(bidderCode, custBidObj) {
// 2) set keys from specific bidder setting override if they exist
if (bidderCode && custBidObj && bidder_settings && bidder_settings[bidderCode] && bidder_settings[bidderCode][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING]) {
setKeys(keyValues, bidder_settings[bidderCode], custBidObj);
custBidObj.alwaysUseBid = bidder_settings[bidderCode].alwaysUseBid;
custBidObj.sendStandardTargeting = bidder_settings[bidderCode].sendStandardTargeting;
}

Expand Down
5 changes: 1 addition & 4 deletions src/auctionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export function newAuctionManager() {
let _auctions = [];
let auctionManager = {};

// return bids whose status is not set. Winning bid can have status `targetingSet` or `rendered`.
const isUnusedBid = (bid) => bid && !bid.status;

auctionManager.addWinningBid = function(bid) {
const auction = _auctions.find(auction => auction.getAuctionId() === bid.auctionId);
if (auction) {
Expand Down Expand Up @@ -62,7 +59,7 @@ export function newAuctionManager() {
return auction.getBidsReceived();
}
}).reduce(flatten, [])
.filter(isUnusedBid);
.filter(bid => bid);
};

auctionManager.getAdUnits = function() {
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DEFAULT_DEBUG = false;
const DEFAULT_BIDDER_TIMEOUT = 3000;
const DEFAULT_PUBLISHER_DOMAIN = window.location.origin;
const DEFAULT_COOKIESYNC_DELAY = 100;
const DEFAULT_ENABLE_SEND_ALL_BIDS = false;
const DEFAULT_ENABLE_SEND_ALL_BIDS = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this changing? It's kind of a big change, isn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

const DEFAULT_USERSYNC = {
syncEnabled: true,
pixelEnabled: true,
Expand Down
19 changes: 2 additions & 17 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,7 @@ $$PREBID_GLOBAL$$.getAdserverTargetingForAdUnitCode = function(adUnitCode) {

$$PREBID_GLOBAL$$.getAdserverTargeting = function (adUnitCode) {
utils.logInfo('Invoking $$PREBID_GLOBAL$$.getAdserverTargeting', arguments);
return targeting.getAllTargeting(adUnitCode)
.map(targeting => {
return {
[Object.keys(targeting)[0]]: targeting[Object.keys(targeting)[0]]
.map(target => {
return {
[Object.keys(target)[0]]: target[Object.keys(target)[0]].join(', ')
};
}).reduce((p, c) => Object.assign(c, p), {})
};
})
.reduce(function (accumulator, targeting) {
var key = Object.keys(targeting)[0];
accumulator[key] = Object.assign({}, accumulator[key], targeting[key]);
return accumulator;
}, {});
return targeting.getAllTargeting(adUnitCode);
};

/**
Expand Down Expand Up @@ -190,7 +175,7 @@ $$PREBID_GLOBAL$$.setTargetingForGPTAsync = function (adUnit) {
targeting.resetPresetTargeting(adUnit);

// now set new targeting keys
targeting.setTargeting(targetingSet);
targeting.setTargetingForGPT(targetingSet);

// emit event
events.emit(SET_TARGETING);
Expand Down
11 changes: 6 additions & 5 deletions src/secureCreatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import events from './events';
import { fireNativeTrackers } from './native';
import { EVENTS } from './constants';
import { isSlotMatchingAdUnitCode } from './utils';
import { auctionManager } from './auctionManager';

const BID_WON = EVENTS.BID_WON;
Expand Down Expand Up @@ -67,11 +68,11 @@ function sendAdToCreative(adObject, remoteDomain, source) {
}

function resizeRemoteCreative({ adUnitCode, width, height }) {
const iframe = document.getElementById(window.googletag.pubads()
.getSlots().find(slot => {
return slot.getAdUnitPath() === adUnitCode ||
slot.getSlotElementId() === adUnitCode;
}).getSlotElementId()).querySelector('iframe');
const iframe = document.getElementById(
window.googletag.pubads().getSlots()
.filter(isSlotMatchingAdUnitCode(adUnitCode))
.find(slot => slot)
.getSlotElementId()).querySelector('iframe');

iframe.width = '' + width;
iframe.height = '' + height;
Expand Down
Loading