Integrating DoubleClick for Publishers into WordPress

Share this article

When building my new site, I wanted a professional solution for my ad management. I wanted to do more than just AdSense ads, as well as combining ad units into topic based bundles for better targeting. I’d heard of DoubleClick for Publisher (DFP) before. DFP, bought by Google in 2008, is free if you’re serving less than 90 million impressions per month. You are then using the Small Business edition, and that version is used for this tutorial. My site is built on WordPress, and integrating it requires a few steps for it to work. That is, if you want to get the same method of targeting I used on my own site. I will first explain what I tried to achieve, and in a screencast I will show you how it’s done.

The idea

My site is divided into several different topics, like security officer jobs or passenger service agent jobs. It’s a so-called niche site. For most topics I have both a job description page, and a separate page with vacancies. I wanted these two pages to allow the same targeted ads. I also put up an article series for air hostess jobs (have a look to see what I mean), consisting of five pages. The whole series should have the same targeting possibilities. The article targeting allows for in-content ads (468×60) and a large 300×600 unit in the sidebar, and there are also two run-of-site ad units (728×90 header and 300×250 sidebar) set up around the content. Have a look at the linked pages to get the idea. In the screenshot below you can see the ROS ads outlined in red, and the targeted ads outlined in blue. DFP for WP The little marks in the left corner with the size displayed within are generated by the Google Publisher Toolbar, which will be shown in the screencast.

The realisation

So far the idea seems pretty clear and easy, but there are a few hurdles to overcome:
  • For optimal reporting, each targeted ad needs it’s own unit in Google DFP.
  • Every targeted unit on a page needs to be combined with the other units on that page into an ad zone.
  • Ad code needs to be implemented within the content, something WordPress isn’t too fond of.
  • For the sidebar ads to be targeted you need to be able to add custom sidebars.
  • The header ad is something which is built-in in most templates. If not, this needs to be coded in (not included in this tutorial).
  • Google DFP uses a lot of code for each ad unit, some of which needs to be inserted into the of each page.
The following screencast will take you through all these steps. I will show you how to:
  1. Generate ad units in Google DFP, and combine these into ad placements
  2. Generate Google DFP tags (ad code), and implement this in the body of your site (in-content, sidebars and header)
  3. Insert the relevant code into the each section

The screencast

[youtube 4K4bWJeg8ec]

The resources

In this screencast, I made use of the following theme, plugins and services: Theme: Plugins WordPress:
  • Code Insert Manager: Used for inserting code in the head of a page
  • Custom Fields Shortcode: Used for inserting code in the body of a page
  • Custom Sidebars: To be used if your template doesn’t allow you to add custom sidebars. Not used in this tutorial
  • Duplicate Widget: Used to set up Run of Site ad code in one sidebar widget, and use the same code in other sidebars. This way you only need to change one widget
Plugins Chrome: Ad manager:
Demo site:

Frequently Asked Questions (FAQs) about Integrating DoubleClick for Publishers into WordPress

What is DoubleClick for Publishers (DFP) and how does it work?

DoubleClick for Publishers (DFP) is a comprehensive hosted ad serving platform that streamlines your ad management, whether you deliver ads to websites, mobile webpages, mobile apps, games, or a combination. It offers a complete toolkit to manage your ads for multiple devices and gives you the power to serve, manage, and report on your online ads all in one place. It’s designed to increase your ad revenue and control over your ads, while reducing the time and cost associated with managing an ad business.

How can I integrate DFP into my WordPress site?

Integrating DFP into your WordPress site involves a few steps. First, you need to create an account with Google Ad Manager (formerly DFP). Then, you need to create ad units within Google Ad Manager and generate the ad tags. These ad tags are then placed into your WordPress site either directly into the theme files or using a plugin that allows for ad placement.

What are the benefits of using DFP on my WordPress site?

DFP offers several benefits for WordPress site owners. It allows you to manage all your ads from one place, regardless of who the advertiser is. It also provides advanced features like ad scheduling, targeting, and tracking, which can help increase your ad revenue. Plus, it’s free to use for small to medium-sized publishers.

Can I use DFP with other ad networks?

Yes, DFP can be used in conjunction with other ad networks. It allows you to manage and prioritize all your ads from different networks in one place, ensuring that the most profitable ads are always displayed first.

How does DFP compare to other ad management platforms?

DFP stands out from other ad management platforms due to its advanced features and integration with the Google ecosystem. It offers sophisticated ad serving capabilities, detailed reporting, and revenue optimization tools that are not available in many other platforms.

What is the difference between Google Ad Manager and DFP?

Google Ad Manager is the new name for what was previously known as DoubleClick for Publishers (DFP) and DoubleClick Ad Exchange. It’s a unified platform that combines the features of these two products and offers advanced tools for managing, serving, and measuring ads.

How can I optimize my ad revenue with DFP?

DFP offers several tools for optimizing your ad revenue. This includes dynamic allocation, which allows DFP to compete with other ad networks for each impression, and yield groups, which let you set up rules for how different ad networks compete with each other.

Can I use DFP on a mobile WordPress site?

Yes, DFP is designed to work with mobile sites and apps. It offers features like responsive ad units and mobile-specific targeting options to help you maximize your ad revenue on mobile.

How can I track the performance of my ads with DFP?

DFP provides detailed reporting tools that let you track the performance of your ads. You can see data on impressions, clicks, click-through rates, and revenue, and you can also create custom reports to track specific metrics.

What kind of support is available for DFP users?

Google offers a range of support options for DFP users. This includes online documentation, tutorials, and a help center, as well as community forums where you can ask questions and share tips with other users.

Jacco BlankenspoorJacco Blankenspoor
View Author

Jacco Blankenspoor is a website developer from the Netherlands, and is currently just building lots of different websites. When he is not working on you might catch him grinding coffee.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week