PreBid Js Implementation and Troubleshooting In DFP
Prebid.js Troubleshooting Guide
Prebid.org does not support any version of Prebid.js prior to version 1.0.
Use this guide to troubleshoot your Prebid.js integration. You can follow this guide sequentially to determine whether Prebid.js is working as intended on your website. It takes you through the ad call from start to finish.
- Check Your Prebid Version
- Delay the Ad Server Call so Key-Values can be Set
- Check the Ad Units on the Page
- List your Bids and Bidders
- Verify your Ad Server Targeting
- Check the Ad Server’s Auction
- Look for the Winning Bid
- Related Topics
Check Your Prebid Version
The open source code in Prebid.js can change frequently. To see what version of Prebid.js you are using, open your browser console and type
You can reference this against the changes listed in the Prebid.js Release Notes.
Delay the Ad Server Call so Key-Values can be Set
Make sure that you delay any calls to the ad server. This allows all of the key-values to be set before the auction in the ad server occurs.
Within DFP, this is achieved by adding the following code to your page. It should be called before any of the ad server code to make sure it runs first.
Check the Ad Units on the Page
Make sure the ad units configured for Prebid.js match up with the ad units that have been set up in your ad server.
You can review what ad units have been configured for Prebid by opening your browser console and typing
pbjs.getBidResponses();. This will show a list of what div IDs are present:
List your Bids and Bidders
Open your browser console and type
pbjs.getBidResponses(); to see a list of the ad units that have been configured. This also shows what bids have been returned from each of the bidder partners in chronological order as shown in the screenshot below.
To see all of the winning bids, open your browser console and type
Keep in mind that any bid responses that come back after the timeout you configured during setup will not be sent to the ad server.
You can also print this data to the console in table format for easier reading.
Verify your Ad Server Targeting
After the auction on page has occurred, Prebid.js will set key-value targeting for the ad server for those bids that have been returned before the timeout you configured during setup.
To see what values Prebid.js intends to send to the ad server, open your browser console and type
pbjs.getAdserverTargeting(); as shown below:
Note that if no bids are returned, no key-values will be set. You may need to increase your timeout setting or reach out to your bidder partners to determine why no bid responses are being sent.
Check the Ad Server’s Auction
After the Prebid auction has occurred and key-values have been set for the ad server, the ad server will use the line items targeting those key-values within its auction.
If you’re using DFP, you can verify this by using the Google Publisher Console, which can be accessed as follows:
- Open your browser’s console and type
googfcas a query parameter to the URL. Then, click the Delivery Diagnostics option to reveal most of the information described below.
To make sure your ad server is set up correctly, answer the following questions:
- How many ads have been fetched for an ad unit? Ideally, only 1 ad will be requested on page load. If not, check for unnecessary extra calls to the ad server in your page’s source code.
- Are the key-values being set in the ad server? If not, review your page’s source code to ensure that the Prebid auction completes before sending the key-value targeting to the ad server.
- Has the ad server order been activated? If not, you’ll have to activate the order to see Prebid-delivered ads.
- Are there other higher priority campaigns running within your ad server? Higher priority campaigns will prevent Prebid ads with a higher CPM bid from winning in the ad server’s auction. For testing purposes, you may want to pause these campaigns or have them excluded when the prebid key values are present.
- Is there other remnant inventory in the ad server with a higher CPM that is winning? To test for this, you may want to use a test creative set up within a bidder partner that has a high CPM or create artificial demand with a bidCPMadjustment.
- Have you set up all of the line items in the ad server to match the setPriceGranularity setting within Prebid.js? All of the line items that correspond to your price granularity settings must be set up in your ad server. When there are gaps in the price granularity of your line item setup, bids will be reduced according to the size of the gap. For example, with dense granularity, a $3.32 bid will be sent to the ad server as $3.30.
Look for the Winning Bid
When a prebid line item wins the ad server’s auction, a
renderAd event will be logged in the browser console. To see this event, you need to do either of the following before the auction:
- Have typed
pbjs.logging=trueinto your your browser console
pbjs_debug=trueas a query parameter to the URL
When this event is logged, it shows that Prebid.js has requested to render the ad from the winning bidder partner, and that this partner’s bid has won both the Prebid and ad server auctions.