This is the second tutorial of a series about Google DoubleClick for Publishers. DFP is a service that can seem incredibly complicated to the uninitiated, so this series aims to keep it simple.
If you have one or two websites that get moderate amounts of web traffic and you want to know how best to generate revenue, sell ads directly to businesses and optimize your income, then this series is for you. I'll do my best to walk you through the process I go through with my own sites, keeping the jargon simple and sticking to the basics. Please get started by reading part one, Introduction to Google DFP Small Business.
What's Google DFP Small Business?
Just to refresh, Google DFP provides a free advertising service that can power ad delivery across your website(s). You can use it to fill ads from Google's own AdSense marketplace as well as from advertisers you sell directly to and other third-party networks. This introductory video provides a simple overview:
Now let's get started instrumenting our website for Google DFP.
Defining Our Ad Inventory
As we reviewed in part one, Ad Inventory is all of the advertising space you have available to sell on your website. If you printed out every page of your website and cut out all the advertisements and stacked them, that stack would represent your inventory.
Instrumenting a Basic Website
For the purposes of this tutorial, I'll guide you through setting up advertising for a new site I'm configuring called ProTools.io. The site uses a knowledge base theme to make it easy to find web services and tools for developers and publishers.
Let's define our ad inventory for the ProTools website:
Initially, I'll offer three advertising spots per page. There will be two in the right sidebar: a small square 250 x 250, and a wide skyscraper ad 160 x 600. And there will be one above the comments, a small banner 468 x 60. For more information on these, see Google AdSense's Guide to Ad Sizes.
Creating Ad Units
DFP refers to all of the ad spaces on your website where ads go as Ad Units. Or as Google says, "An ad unit is a representation in DFP of one space where ads can be delivered." To begin, we need to create ad units for each of the three spots described above.
In DFP, visit the Inventory page to begin:
Click on New ad unit to define each of these three ad units:
It's helpful if you name ad units descriptively with the website name, section, placement and dimensions. For example, my top sidebar square ad is called protools_sidebar_top_square_250x250.
You can leave the subsequent defaults as they are and save the ad unit. Note that the default enables Google AdSense to fill ad space that's not ordered by your own clients.
When you've added all three, you can see the Ad Units listed below:
For future reference, Google offers some good examples for when to create additional ad units:
If you have the same 300x250 ad slot at the top of all of your content pages, you might want to create just one ad unit. However, if you'll be selling your inventory by website section, you might need separate ad units for each section. If you have ad slots at the top and bottom of your content pages, you probably want to create separate ad units so that you can target, price, and report on these ad slots separately.
Generate Tags: Add DFP Code to Your Website
On the Generate tags page we add all three of the ad units which we want to use. Then, click the Generate tags button.
Here's an example of my
Below that, you'll see individual
<div> blocks for each of the ad units:
To be clear, the upper
<head> script needs to appear on any page with an ad. However, the individual ad unit script only needs to appear exactly where you want to place the ad.
Place Tags in WordPress
Note: if you use a code repository like GitHub for your themes, make sure you integrate this change into your repository.
For the small banner 468x60 above the comments, we edit the Single Post single.php file in WordPress. This change would also go into your code repository if you're using one.
Next, we'll add Text widgets to the sidebar for each of the two sidebar ads. These widgets don't need to be added to the code repository:
Centering Google Ads
I've found that centering Google Ads with a wrapper div with
style="text-align:center;" doesn't work but that the deprecated
<center></center> tag does.
The Finished Page With Advertisements
When you view the page again, you can see the ads appear immediately:
In this episode, you've learned to define ad inventory for your website, create ad units, generate tags (or code) and place this code in the appropriate areas of your website. I hope you've found this illustrative. As you can tell, I'm deliberately trying to keep the scope of each episode fairly small. It's easy to get overwhelmed by DFP, and I'd rather you feel a certain level of confidence with each new area.
In the next episode, we'll explore Google DFP Placements in order to target ads at related hot areas of our website, such as related pages that receive a lot of search traffic.
Please feel free to post your questions and comments below. You can also follow me on Twitter @reifman or email me directly. You can also browse my Tuts+ instructor page to see other tutorials I've written.