Debugging Prebid.js
Use these commands in your browser console to inspect and debug Prebid.js configurations.
How to Use These Commands
- Open the webpage you want to debug
- Open browser's developer tools (F12 or right-click → Inspect)
- Click on the "Console" tab
- Copy a command and paste it into the console
- Press Enter to execute
View All Prebid Configurations
pbjs.getConfig();
Displays the complete Prebid.js configuration object with all settings.
View All Bid Responses
pbjs.getBidResponses();
Shows all auction responses from bidders, including CPM, size, and ad server targeting.
View Winning Bids
pbjs.getAllWinningBids();
Shows only winning bids across all auctions.
View Configured Ad Units
pbjs.adUnits;
Displays all ad units configured for Prebid auctions.
View Ad Server Targeting
pbjs.getAdserverTargeting();
Shows key-value pairs sent to the ad server for targeting.
Explore Full Prebid Object
pbjs.que.push(function () {
console.log(pbjs);
});
Logs the entire Prebid.js object to explore all properties and methods.
Enable Debug Mode
Turns on verbose console logging for Prebid events.
For a Specific Page View
Add pbjs_debug=true to the URL's query string:
https://yoursite.com/page?pbjs_debug=true
Example:
/pbjs_demo.html?pbjs_debug=true
Programmatically
Enable debug mode from the browser console:
pbjs.setConfig({ debug: true });
For more information, see the Prebid.js troubleshooting guide.
Common Issues
No Bids Returned
Symptoms:
- Empty bid responses
- Ad units not filled
- Console shows no bid activity
Debugging Steps:
- Check if Prebid.js is loaded:
typeof pbjs !== "undefined";
- Verify ad units are defined:
pbjs.adUnits;
- Check adapter configuration:
pbjs.getBidderConfig();
- Inspect network requests in the Network tab for bidder endpoints
Common Causes:
- Incorrect bidder parameters
- Invalid placement IDs
- Ad blockers interfering
- Timeout too short
- Invalid ad sizes
Timeout Issues
Symptoms:
- Bids arriving after timeout
- Incomplete auction results
Check Current Timeout:
pbjs.getConfig("bidderTimeout");
Increase Timeout:
pbjs.setConfig({
bidderTimeout: 3000, // 3 seconds
});
Adapter Not Working
Verify Adapter is Included:
pbjs.installedModules;
This lists all installed Prebid.js modules. Ensure your bidder adapter is in the list.
Check Adapter Configuration:
// Get configuration for specific bidder
pbjs.getBidderConfig("bidderName");
Price Granularity Issues
Check Current Price Granularity:
pbjs.getConfig("priceGranularity");
Common Granularity Settings:
"low"- $0.50 increments"medium"- $0.10 increments up to $20"high"- $0.01 increments up to $20"auto"- Sliding scale"dense"- More granular buckets
Network Debugging
Inspect Bid Requests
- Open browser DevTools (F12)
- Go to the Network tab
- Filter by your bidder domain (e.g.,
prebid.openx.net) - Click on the request to view:
- Request payload (ad unit details, sizes, etc.)
- Response body (bid responses)
- Headers
Check for Failed Requests
Look for:
- 400 errors (bad request - check parameters)
- 403 errors (forbidden - check account/placement IDs)
- 404 errors (not found - check endpoint URLs)
- Timeout/cancelled requests
Advanced Debugging
Bidder Specific Debugging
Some bidders have their own debug modes:
pbjs.setConfig({
debug: true,
appnexusAuctionKeywords: {
debug: ["true"],
},
});
Check your bidder's documentation for specific debug options.
Event Listeners
Monitor Prebid.js events:
pbjs.onEvent("auctionEnd", function (args) {
console.log("Auction ended:", args);
});
pbjs.onEvent("bidWon", function (bid) {
console.log("Bid won:", bid);
});
pbjs.onEvent("bidTimeout", function (timedOutBids) {
console.log("Bids timed out:", timedOutBids);
});
Available events:
auctionInit- Auction startsauctionEnd- Auction completesbidRequested- Bid request sentbidResponse- Bid response receivedbidWon- Bid wins the auctionbidTimeout- Bid times out
Verbose Logging
Get extremely detailed logs:
pbjs.setConfig({
debug: true,
enableSendAllBids: true,
});
Testing Tools
Professor Prebid Chrome Extension
Install the Professor Prebid extension to visualize:
- Real-time bid data
- Auction timelines
- Bidder performance
- Configuration issues
Manual Testing
Test specific scenarios:
pbjs.requestBids({
adUnitCodes: ["specific-ad-unit"],
bidsBackHandler: function (bids) {
console.log("Test auction complete:", bids);
},
});
Performance Monitoring
Check Auction Duration
pbjs.onEvent("auctionEnd", function (auction) {
console.log("Auction duration:", auction.auctionEnd - auction.auctionStart, "ms");
});
Monitor Bidder Timeouts
Track which bidders consistently timeout:
pbjs.onEvent("bidTimeout", function (timedOutBids) {
timedOutBids.forEach(function (bid) {
console.log("Timeout:", bid.bidder, bid.adUnitCode);
});
});
Support Resources
- Prebid.js Documentation
- Prebid.js Troubleshooting Guide
- Prebid.js Developer Tools
- Contact your header bidding partner for bidder-specific support