How to debug DFP ad server calls

DFP comes with a handy debug console that gives you some information about the ad calls on your page, however there are other ways to inspect exactly what data is being sent to the DFP ad server and exactly what content is coming back.

Please see my post How to refresh Google DFP ads if you need to refresh ads for ajax sections of your site, I have also written articles on setting up DFP targeting parameters and setting up DFP ads.

The DFP console

The Google debug console will give some basic information on what has been sent to the DFP server.

To open the console add a query parameter of google_console to the URL of a DFP enabled page. Once the page is loaded press ctrl+f10 to actually bring up the console.

Within the console you should see each ad slot under the 'Ad Slots' tab along with some useful information about how each slot has been setup.

On the 'Page Request' tab you will see more detailed information about the configuration of ads on the page, you should see each setting and ad slot getting pushed into DFP.

The console is useful to check that all of the intended information is getting sent over to DFP. If there is an error that is preventing ads from displaying properly then you should see an error in the 'Page request' tab with some information about what went wrong, these errors are generally not entirely useful and you may have to debug the ad call itself in order to see what the issue is.

Debugging the ad server calls

If ads are not displaying properly on a page and ads are setup properly within the DFP manager then it's likely that you are sending through erroneous data to the DFP server. I've had issues with slot sizes being sent through incorrectly, mangled ad paths, illegal characters, incorrect targeting parameters and the DFP URL itself being too long (see below).

If you want to further debug what is getting sent to the DFP server then you will need to examine the URL that is used to retrieve ads from the server.

You can capture this URL by using Firebug or any other browser's debug console. Simply open the console, switch it to the network tab and then open the page that you want to debug. Look for a call to, this is the actual call to the DFP server. There may be more than one ad call on a page depending how DFP is set up.

In most console's you should see a breakdown of the query parameters when selecting a URL in the network tab, you can map these to theDFP slots and settings for the page.

Here's a breakdown of some of the key query parameters:

  • iu_parts: Comma separated list of the ad path elements of the page.
  • prev_iu_szs: A comma separated list of the sizes of each ad slot on the page, slots that have multiple sizes will have a pipe separating each size.
  • prev_scp - Slot specific targeting parameters.
  • cust_params - Global targeting parameters.
  • biw/bih: Browser width/height.

In addition to examining the query parameters you can also to see exactly what ad HTML was sent back from the ad server, simply click on the response tab within the console and you should see a large string full of the ads HTML, pop this into a JS beautifer so you can examine what came back in detail.

You can of course examine the ads on the page directly, simply use your console to inspect the html of the ad, you should see an iFrame containing the ad code.

DFP ad call character limit

One thing to be wary of is that the DFP server has a maximum character limit for URLs, I believe it is 2000 characters. If a URL used to retrieve the ads is over this limit then the ads will not be returned properly and may not display at all.

This limit can be reached if you have lots of ad slots with targeting parameters, slot level targeting parameters can cause this limit to be reached quickly, switch to global targeting where possible to reduce the URL size.