Tutorial: How to Setup Google DFP for Selling Ads

Consider the following scenarios:

  • You use an advertising network like Google AdSense for serving ads on your website but would also like to accept ad campaigns from brands, digital agencies and other direct advertisers.
  • You have partnered with multiple CPM based ad networks - say AdSense, BuySellAds, TribalFusion, etc. - but would only like to run ads from the network that pays you the most money (or maximum CPM)
  • You would like to display ads based on certain criteria. For instance, visitors from U.S. are shown one set of ads while visitors who are in India and use Windows are targeted with a different set of ads.
  • You are using AdSense across your website and the CPMs may vary. Instead of serving low-cost Google AdSense ads, say when the CPM is less than $1, you would like to display in-house ads that promote your older article or your other website.

Google DFP, or DoubleClick for Publishers, is a perfect solution in either of the above scenarios. DFP is a free ad server from Google that lets you sell ad space on your website more effectively and also helps maximize your advertising revenue.

Google DFP

With DFP, you may run standard banner ads, text ads (JavaScript based) or even rich-media campaigns that use video and Flash creatives. The tool, which was formerly known as Google Ad Manager, requires no downloads or installation and any website publisher can sign-up for the DFP program as long as they have an active Google AdSense account.

Sell Your Advertising Space with Google DFP

Say you have a blog where you cover a variety of topics including technology, sports and entertainment. An advertiser wants to serve banner ad campaigns on all your tech related pages. As part of the deal, he has agreed to pay $20 CPM for all US impressions and you can fill your remnant inventory through Google AdSense ads.

Let’s see how we can easily setup such an ad campaign through Google DFP.

Step 1: Create Ad Units

We need to tell DFP about all the advertising spaces on our web pages. For this example, we’ll create three ad units - the 300x250 rectangle, the 160x600 skyscraper and the 468x60 banner. These are standard IAB units though you can define custom ad sizes as well.

Go to DFP –> Inventory –> Ad Units –> New Ad Unit (choose Web or Mobile). Give your ad unit a descriptive name so that you can easily determine where that ad unit will be displayed and also include the size of that unit. You may check the option “Maximize revenue of unsold and remnant inventory with AdSense” in case you wish to display Google Ads when there are no direct ads or when Google is offering better CPM than the direct advertiser.


Bonus Tip: If you set the target windows in the Ad Unit as ”_blank”, the ads will open in a new window. Google doesn’t allow you to open AdSense ads in a new window but if you are using DFP, AdSense ads can be configured to open in a new window without breaking the AdSense program policies.

Step 2: Define Placements

You have multiple ad units on the website and there’s a possibility that an advertiser may want to target one or more of these ad units. For instance, an advertiser may want to target your Medium Rectangle and Skyscraper ad units on tech-related pages of the site. You can group these ad units into a placement that can be targeted by advertisers.

Go to the Inventory tab –> Placements –> New Placement and add your placement. To keep things simple, we will associate only one ad unit (300x250) with our ad placement. Check the option that says “Offer this placement to advertisers” through AdWords to attract more advertisers. You should carefully fill the AdSense targeting section for that placement since whatever you write here will be viewable by AdWords advertisers.


Step 3. Create an Order

Now that we have defined our ad inventory, it’s time to create the client’s order (or campaign). The client /advertiser will specify where he wants to place the ad, what kind of demographics he wants to target, what’s the price he is willing to pay and how long will the campaign run on the website.

Go to DFP –> Orders –> New Order. Create a company for the advertiser and then fill-in the order details under “New Line Item.” Set the Type to “Price Priority” if you want the highest paying ads to be served on your site. Set Value CPM equal to the price that the client will pay and then add the targeting criteria.


Also see: Increase AdSense Revenue with Google DFP

Step 4. Upload the Ad Creative

Next you have to upload the ad creative that will display on your web pages. You can either upload images, Flash videos or even snippets of HTML and JavaScript in case you’re going with text ads.

Go to DFP – > Line Items and select the “Line Item” that you’ve created in the previous step. Click Add Creatives and either upload the image / SWF Flash file or choose the Text Ad format to enter a text-on ad (like the one you see on Google search pages).

You can even upload multiple creative ads per line item and they’ll display evenly across the site – you can compare the click-through rates of these creatives to determine the ad copy that performs best with your visitors.


Step 5. Get the Ad Tags for your Site

We’ll grab the JavaScript code from Google Ad Manager DFP and copy-paste it into our website /blog template.

Click the Inventory tab in your DFP dashboard and choose “Generate Tags” – select the appropriate ad unit (the one you created in Step #1) and choose “Generate Tags.”   Use the Google Publisher Tag (asynchronous) option from the drop-down and add this code to your website. Google DFP should begin serving ads on your pages in the next 10-15 minutes.

Here’s a narration-less screencast that captures all the above steps in a quick video.

If you ever have trouble serving ads through DFP , just open any page of your website, add ?google_debug to the URL and reload. This will generate a tracing log that should help you debug the problem, if any.

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory


Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.