Skip to content

Commit

Permalink
Sets a filter for the current bid request as an array of ad unit codes.
Browse files Browse the repository at this point in the history
Applies the filter when calling reporting APIs `getBidResponses`, `getAdserverTargeting`.
Queues a bid request if a previous request is still running, closing over instance data.
Clears previous bids from placements included in current bid request (remove stale bids).

Note that if a placement is included in one request and a second request as well, and the second request is made before the first request has rendered an ad, the bids for the first request will be cleared and the `renderAd` function will throw an error as the bids cannot be found. However, the placement should be immediately filled with the results of the second request. The error is not caught so as to warn that a placement was overwritten, and care should be taken not to request bids for a placement with a request already in flight.

fixes #772
fixes #590
  • Loading branch information
protonate committed Nov 7, 2016
1 parent 561c93a commit 1edc943
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ function getAllTargeting(adUnitCode) {
return targeting;
}

/**
* When a request for bids is made any stale bids remaining will be cleared for
* a placement included in the outgoing bid request.
*/
function clearPlacements() {
$$PREBID_GLOBAL$$._bidsRequested = $$PREBID_GLOBAL$$._bidsRequested
.filter(request => request.bids
Expand Down

0 comments on commit 1edc943

Please sign in to comment.