From 205b1e4bd8cc615762a810870f07ea0dfbac1495 Mon Sep 17 00:00:00 2001 From: bretg Date: Tue, 25 Aug 2020 15:22:01 -0400 Subject: [PATCH] added details to requestBids: example and response (#2274) --- dev-docs/publisher-api-reference.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dev-docs/publisher-api-reference.md b/dev-docs/publisher-api-reference.md index f56a684cf7..e88ac2cc56 100644 --- a/dev-docs/publisher-api-reference.md +++ b/dev-docs/publisher-api-reference.md @@ -672,10 +672,31 @@ Request bids. When `adUnits` or `adUnitCodes` are not specified, request bids fo | requestObj.adUnitCodes | Optional | `Array of strings` | adUnit codes to request. Use this or `requestObj.adUnits`. Default to all `adUnitCodes` if empty. | | requestObj.adUnits | Optional | `Array of objects` | AdUnitObjects to request. Use this or `requestObj.adUnitCodes`. Default to all `adUnits` if empty. | | requestObj.timeout | Optional | `Integer` | Timeout for requesting the bids specified in milliseconds | -| requestObj.bidsBackHandler | Optional | `function` | Callback to execute when all the bid responses are back or the timeout hits. Callback will be passed two parameters, the bids themselves and `timedOut`, which will be true if any bidders timed out. | +| requestObj.bidsBackHandler | Optional | `function` | Callback to execute when all the bid responses are back or the timeout hits. Callback will be passed three parameters, the [bidResponses](#module_pbjs.getBidResponses) themselves, a `timedOut` flag (true if any bidders timed out) and the `auctionId`. | | requestObj.labels | Optional | `Array of strings` | Defines [labels](#labels) that may be matched on ad unit targeting conditions. | | requestObj.auctionId | Optional | `String` | Defines an auction ID to be used rather than having the system generate one. This can be useful if there are multiple wrappers on a page and a single auction ID is desired to tie them together in analytics. | +Example call +``` +pbjs.requestBids({ + bidsBackHandler: sendAdserverRequest, + timeout: 1000, + labels: ["custom1"] +}); +``` + +Example parameters sent to the bidsBackHandler: +``` +function sendAdserverRequest(bids, timedOut, auctionId) { + // bids + // {"test-div":{"bids":[{"bidderCode":"bidderA", ...}]}} + // See [getBidResponses function](#module_pbjs.getBidResponses) for details + // timedOut=false + // auctionId="130aad5e-eb1a-4b7d-8939-0663ba251887" + ... +} +``` +