| layout | example | ||||
|---|---|---|---|---|---|
| title | Examples | ||||
| description | Basic Prebid.js Example | ||||
| top_nav_section | dev_docs | ||||
| nav_section | quick-start | ||||
| about |
|
||||
| jsfiddle_link | jsfiddle.net/prebid/bhn3xk2j/458/embedded/html,result | ||||
| code_lines | 110 | ||||
| code_height | 2389 | ||||
| pid | 10 |
This section is the only prebid config you may need to update frequently when:
- adding new bidders
- introducing new ad units
- changing timeout settings
Some publishers put this section of the code into a separate JS file for ad ops to own and manage.
Register all your ad units in page here. The key code is an identifier of this ad unit. If you're using GPT, we recommend putting in that ad unit's slot element ID. If you don't put in the slot element ID, pbjs.setTargetingForGPTAsync() would not work, but you can still manually set targeting using pbjs.getAdserverTargeting() or pbjs.getBidResponses() (API Reference).
For each ad unit, register the header bidding bidders' tag Ids. For example in this case, the first ad unit has AppNexus and Sovrn bidding, and the second ad unit has Rubicon bidding. You can find the complete reference on bidder params here.
Generate your version of Prebid.js with the selected adapters here. Do not use the prebid.js version on the left in your production environment.
See full documentation from DFP here.
- Ads will be requested with a
googletag.pubads().refresh()call. See line 55 in thesendAdserverRequest()call. - This should be set prior to enabling the service.
- GPT's Async mode must be used.
Prebid.js sends out all registerd bid requests at pbjs.requestBids().
Callback bidsBackHandler will be triggered when all bids are back for the requested ad units.
Send out GPT ad request when all bids are back, or when timeout is hit, whichever comes earlier.
This refresh call will trigger GPT to send out the ad request for all the defined ad units on page. It's important to pair this with disableInitialLoad(), as in line 40.
Call pbjs.setTargetingForGPTAsync() before the refresh call to let prebid.js attach all the bids to the ad units.
The page will only asynchronously wait for PREBID_TIMEOUT amount of time before it calls sendAdserverRequest() to let GPT send out the bids.