Skip to content

Commit 11ae6bf

Browse files
jaiminpanchal27Matt Kendall
authored and
Matt Kendall
committed
Targeting updates (#1689)
* Cherry pick alias bidder * Cherry pick alias bidder * Cherry pick alias bidder * Updated test case to not import adapter * targeting updates * targeting functions refactoring * Refactored functions * more refactor of function * added jsdoc and some more refactor * check bid expiry and filtering used bids
1 parent 31f8bed commit 11ae6bf

12 files changed

+330
-148
lines changed

src/auction.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ export function getKeyValueTargetingPairs(bidderCode, custBidObj) {
364364
// 2) set keys from specific bidder setting override if they exist
365365
if (bidderCode && custBidObj && bidder_settings && bidder_settings[bidderCode] && bidder_settings[bidderCode][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING]) {
366366
setKeys(keyValues, bidder_settings[bidderCode], custBidObj);
367-
custBidObj.alwaysUseBid = bidder_settings[bidderCode].alwaysUseBid;
368367
custBidObj.sendStandardTargeting = bidder_settings[bidderCode].sendStandardTargeting;
369368
}
370369

src/auctionManager.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ export function newAuctionManager() {
3131
let _auctions = [];
3232
let auctionManager = {};
3333

34-
// return bids whose status is not set. Winning bid can have status `targetingSet` or `rendered`.
35-
const isUnusedBid = (bid) => bid && !bid.status;
36-
3734
auctionManager.addWinningBid = function(bid) {
3835
const auction = _auctions.find(auction => auction.getAuctionId() === bid.auctionId);
3936
if (auction) {
@@ -62,7 +59,7 @@ export function newAuctionManager() {
6259
return auction.getBidsReceived();
6360
}
6461
}).reduce(flatten, [])
65-
.filter(isUnusedBid);
62+
.filter(bid => bid);
6663
};
6764

6865
auctionManager.getAdUnits = function() {

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DEFAULT_DEBUG = false;
1414
const DEFAULT_BIDDER_TIMEOUT = 3000;
1515
const DEFAULT_PUBLISHER_DOMAIN = window.location.origin;
1616
const DEFAULT_COOKIESYNC_DELAY = 100;
17-
const DEFAULT_ENABLE_SEND_ALL_BIDS = false;
17+
const DEFAULT_ENABLE_SEND_ALL_BIDS = true;
1818
const DEFAULT_USERSYNC = {
1919
syncEnabled: true,
2020
pixelEnabled: true,

src/prebid.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,7 @@ $$PREBID_GLOBAL$$.getAdserverTargetingForAdUnitCode = function(adUnitCode) {
113113

114114
$$PREBID_GLOBAL$$.getAdserverTargeting = function (adUnitCode) {
115115
utils.logInfo('Invoking $$PREBID_GLOBAL$$.getAdserverTargeting', arguments);
116-
return targeting.getAllTargeting(adUnitCode)
117-
.map(targeting => {
118-
return {
119-
[Object.keys(targeting)[0]]: targeting[Object.keys(targeting)[0]]
120-
.map(target => {
121-
return {
122-
[Object.keys(target)[0]]: target[Object.keys(target)[0]].join(', ')
123-
};
124-
}).reduce((p, c) => Object.assign(c, p), {})
125-
};
126-
})
127-
.reduce(function (accumulator, targeting) {
128-
var key = Object.keys(targeting)[0];
129-
accumulator[key] = Object.assign({}, accumulator[key], targeting[key]);
130-
return accumulator;
131-
}, {});
116+
return targeting.getAllTargeting(adUnitCode);
132117
};
133118

134119
/**
@@ -190,7 +175,7 @@ $$PREBID_GLOBAL$$.setTargetingForGPTAsync = function (adUnit) {
190175
targeting.resetPresetTargeting(adUnit);
191176

192177
// now set new targeting keys
193-
targeting.setTargeting(targetingSet);
178+
targeting.setTargetingForGPT(targetingSet);
194179

195180
// emit event
196181
events.emit(SET_TARGETING);

src/secureCreatives.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import events from './events';
77
import { fireNativeTrackers } from './native';
88
import { EVENTS } from './constants';
9+
import { isSlotMatchingAdUnitCode } from './utils';
910
import { auctionManager } from './auctionManager';
1011

1112
const BID_WON = EVENTS.BID_WON;
@@ -67,11 +68,11 @@ function sendAdToCreative(adObject, remoteDomain, source) {
6768
}
6869

6970
function resizeRemoteCreative({ adUnitCode, width, height }) {
70-
const iframe = document.getElementById(window.googletag.pubads()
71-
.getSlots().find(slot => {
72-
return slot.getAdUnitPath() === adUnitCode ||
73-
slot.getSlotElementId() === adUnitCode;
74-
}).getSlotElementId()).querySelector('iframe');
71+
const iframe = document.getElementById(
72+
window.googletag.pubads().getSlots()
73+
.filter(isSlotMatchingAdUnitCode(adUnitCode))
74+
.find(slot => slot)
75+
.getSlotElementId()).querySelector('iframe');
7576

7677
iframe.width = '' + width;
7778
iframe.height = '' + height;

0 commit comments

Comments
 (0)