Tips for Troubleshooting

This page has tips and tricks for troubleshooting issues with your Prebid.js integration.

Turn on Prebid.js debug messages

Add pbjs_debug=true to the end of your page’s URL. For example: /pbjs_demo.html?pbjs_debug=true. This will add two types of messages to your browser’s developer console:

  1. Prebid.js suppresses Javascript errors in the normal mode to not break the rest of your page. Adding the pbjs_debug parameter will expose the Javascript errors.
  2. You’ll find additional debug messages. Filter the messages by string MESSAGE:. For example:


Prebid.js Debug Console


Message Description
Calling bidder When Prebid.js sends out bid requests, this message is logged
Set key value for placement After all the bids came back, or when timeout is reached, prebid.js will set keyword targeting for the defined ad units.
Calling renderAd If a header bidding bid wins the ad server’s auction, prebid.js will render the winning bid’s creative.


Turn on your ad server’s developer console

The ad server’s developer console usually provide information such as targeting, latency, and key events logging. For example, here is a screenshot of DFP’s GPT developer console logs:


Prebid.js Debug Console


See all bids in the console

To print information about all of the bids that come in to the Console on any page that is running Prebid.js, follow these steps.

Open the Chrome Dev Tools. In the Sources tab, next to Content Scripts, click the » button and you can add Snippets:

View Snippets in Dev Tools


Right-click to add a New snippet:

Add New Snippet in Dev Tools


Paste in the following code using Control-V (or Command-V on Mac), and give the snippet a name, such as ‘show-all-bids’:

var responses = pbjs.getBidResponses();
var output = [];
for (var adunit in responses) {
    if (responses.hasOwnProperty(adunit)) {
        var bids = responses[adunit].bids;
        for (var i = 0; i < bids.length; i++) {
            var b = bids[i];
            output.push({
                'adunit': adunit, 'adId': b.adId, 'bidder': b.bidder,
                'time': b.timeToRespond, 'cpm': b.cpm, 'msg': b.statusMessage
            });
        }
    }
}
if (output.length) {
    if (console.table) {
        console.table(output);
    } else {
        for (var j = 0; j < output.length; j++) {
            console.log(output[j]);
        }
    }
} else {
    console.warn('NO prebid responses');
}


Right-click the snippet and choose Run:

Run a Snippet in Dev Tools


Check the output in Console to see the bids:

See Snippet Output in Dev Tools

See all winning bids in the console

To print information about all of the winning bids that come in to the Console on any page that is running Prebid.js, follow these steps.

Open the Chrome Dev Tools. In the Sources tab, next to Content Scripts, click the » button and you can add Snippets:

View Snippets in Dev Tools


Right-click to add a New snippet:

Add New Snippet in Dev Tools


Paste in the following code using Control-V (or Command-V on Mac), and give the snippet a name, such as ‘show-all-winning-bids’:

var bids = pbjs.getHighestCpmBids();
var output = [];
for (var i = 0; i < bids.length; i++) {
    var b = bids[i];
    output.push({
        'adunit': b.adUnitCode, 'adId': b.adId, 'bidder': b.bidder,
        'time': b.timeToRespond, 'cpm': b.cpm
    });
}
if (output.length) {
    if (console.table) {
        console.table(output);
    } else {
        for (var j = 0; j < output.length; j++) {
            console.log(output[j]);
        }
    }
} else {
    console.warn('No prebid winners');
}


Right-click the snippet and choose Run:

Run a Snippet in Dev Tools


Check the output in Console to see the bids (note that this screenshot shows the output from “see all bids” but they’re very similar):

See Snippet Output in Dev Tools