How to Auto-Refresh Ads in DFP (DoubleClick for Publishers)

Last updated on July 15th, 2021 at 08:50 am

If you reading this post, chances are high that you’ve your own ADX account or you’re using a sub-ADX account from any Google Certified Partner. Before we begin, I would like to tell you that we have tested auto-refresh ads and yes, they bring in additional revenue if implemented properly. With the rise of programmatic buying and greater control of machine learning/algorithms in deciding which ad impressions will be delivered, CPM based ad buying has become more prevalent. Refreshing ads at fixed time intervals in common and many SSPs, networks and publishers do this ensuring the ads which are refreshed have good view ability rates. Sovrn auto-refresh view-able impressions every 25 seconds to ensure better revenue for their publishers. In addition to refresh ADX ads or third party ads via DFP, you can also refresh in-house ads or affiliate marketing campaign ads to see which are generating the maximum click through rate and optimize the ad serving based on the ones which gets more clicks. In this post, we are going to discuss how you can auto-refresh ads via DFP (Doubleclick for Publishers), the best practices, and ADX auto refresh policies.


Why Auto-Refreshing of Ads Make Sense?

Visitors consume content and ads as a part of the content. This is where contextual advertising makes the most sense. Additionally, the visitors interact with the ad which might be purely view-able engagement or simply a click-through. Marketers and advertisers who consider view-ability and brand recall as their primary metric can serve CPM based ads. Advertisers who are looking for click to action like purchase, signups, etc would go for CPC bids. Thus, on blogs and websites which have a high engagement rate and time on site, it makes sense to refresh in-view ad units to increase the overall revenue from CPM ads.

courtesy: Google
courtesy: Google

Even, if you’re doing direct advertisement deals, and your site is popular, you don’t want to give the entire session of a user for one ad unit, rather make the advertiser agree for a 60 seconds view-able impression. In this way, you can serve more ad impressions on your blog.

Also Read:  How AI is Set to Disrupt Your Ad Revenue in 2022

Interestingly, you can also tell DFP to display those ads which are getting high clicks, and give some opportunity to other ad units for potential clicks. This will show weightage to the top performing ad unit (in terms of click) and ensure that your ad space is properly monetized. These are some of the benefits of auto-refresh ad tags on DFP. In this tutorial, I will share with you the necessary ad codes that will help you enable create such custom banners which will be your money-making magnet.

Reloading Ads without Refreshing Page in DFP- How to Auto Refresh Ads in DFP

First, you need to have access to Google Doubleclick (DFP), which is an ad server that help publishers to maximize their ad revenue. It is going to be a 3-4 step process where you first need to create an ad unit, then create an order, traffick the order with line items, and finally add creatives to your line items. Once the steps are done, you need to approve your order so that the ad serving is enabled.

Next, you need to generate the ad tag which you’ve created in the first place, and use the code here to make it auto refresh. Once done, you can place the code in your ad widget and make it live on the website. Typically, it takes 3-4 hours for a newly created ad unit to start showing up on your website and if you can’t see it, then you must be doing something wrong.  Once the ads start showing up, you can analyze the performance metrics is real time by going to Reports>Query>New Query. 

DoubleClick for Publishers provides a functionality using which, you can refresh ads directly without a user triggering it. Shared here is a basic understanding of how this thing is implemented.

Let’s start with our standard GPT tag


The above sample code in the <head> section will serve an ad without an ad refresh. Let’s say, I want this ad tag (“defineSlot() function”) to be called every 30 seconds automatically. To achieve this, I’ll first assign it to a variable (specialty of JavaScript). See below:

Also Read:  10+ Best Pay Per Call Affiliate Networks in 2022


We are not done yet. Another code has to be placed in the display call i.e., the respective code which we place in the webpage’s <body> section. The new code should be:


You’ll notice that the variable “_Mrec” which we’ve defined before is being used here. As we’re interested in refreshing the ad slot in every 30 seconds, we must include 30,000 milliseconds at the end of this function.

The refresh code has to be placed after the googletag.display() function. See here:


DFP Refresh Rate

You can use the refresh functionality of DFP to auto-refresh ads from SSPs, Ad networks or Ad Exchange ad tags. If you’re using Ad Exchange ads, then the refresh interval should be anywhere between 30, 60, 90, 120, 180, 240, 360 seconds and needs to be declared by an ADX rule. Otherwise, this would constitute a policy violation. Generally, once you’ve the auto-refresh ads setup, you can then declare them as auto-refresh. With other ad networks, you can also refresh the ads at specific intervals. We suggest to keep the auto-refresh interval between 60-120 seconds.

Can I Refresh AdSense Ads?

Please make sure that you DO NOT serve AdSense ads on such positions. As per Google AdSense policy, refreshing an AdSense ad can terminate your Google AdSense account. You can however, refresh AdX ads but you need to have an approved sub-ADX account for that and declare the existence of such ads in the line item.

Things to Keeping in Mind while Auto-Refreshing Ads via DFP

There are a few things that you should keep in mind while auto-refreshing ads on DFP.

  • Adding refreshing to ad units can impact your audience negatively. So, we recommend to refresh not more than 2 ad units.
  • It is always advisable to use auto-refresh on ad units with desktop traffic. Since, on mobile there isn’t much opportunity for your audience to view the refreshed ads. You can use a sticky footer auto-refresh ad on mobile (320×100) ad size.
  • Use a sticky ad code for a sidebar ad which you’re auto refreshing. Keep the refresh rate of this ad at 30 seconds. While, you can keep the refresh rate of other ads at 60 seconds.
  • Use appealing creatives which using ads to increase their CTR.
  • Let DFP allow higher impressions to those creatives which are clicked more.
Also Read:  10+ Taboola Alternatives List of 2022 for Publishers and Marketers

How to Increase your Ad Revenue with Auto Refresh Ads?

Simply auto-refresh ads may not increase your ad revenue substantially. If you’re using ADX ads and auto-refreshing them, you will see higher revenue for the first few days  which will show signs of consistent dip thereby coming to the plateau (the plateau is still higher than one without auto-refresh). In order to increase your ad revenue with Auto-refresh units, you need to setup your DFP line items to maximize the competition and enable dynamic allocation and DFP First Look. It should be followed by using ad exchange tags as a fallback or passback so that it ensures maximization of the revenue. Creating such a setup requires first hand knowledge of DFP and is beyond the scope of this article. If you’ve more than 10,000 page views a day and good volume of tier one traffic, this setup can substantially increase your overall revenue. Do get in touch with me for a custom setup or consultation! My skype id is: ronniedey.

Our Recommended Monetization Partners:

Looking to Increase your Ad Revenue: Get in touch with me for a personalised consultation and increase your ad revenue across native, display, video (instream and outstream), in-app and other verticals. I also assist in customized DFP setup, header bidding, and content creation strategy. My skype id is: ronniedey. Feel free to connect!

15 thoughts on “How to Auto-Refresh Ads in DFP (DoubleClick for Publishers)”

  1. Hi I am currently working on clients web site and they want to auto refresh dfp tags. I am not sure what is entirely legal and what is not. I noticed there are a few differen types of dfp tags and would like to know which auto refresh can apply to and which not.

    I want to use slot rendered event listener and refresh on paticular slots from there. Is there a way to determine if an paticular ad slot runs adsense and which adx.

    Any help will be much appreciated.

    • Hi Stefan,

      Auto refresh of AdSense ads is not allowed. However, you can auto-refresh AdX ad tags. So, if you want to compete AdSense line items with ADX line items for a particular ad unit, then also, you cannot auto refresh those ads since, it would mean you’re auto-refreshing adsense as well. You may auto refresh ads from other networks provided they allow the same, along with in-house ads. Do let me know if this helps. Do get in touch with me on skype if you’d like to discuss more about it. My id is: ronniedey

  2. Hello,

    you have actually an error in your code.

    You define _Mrec as a local variable inside the first googletag.cmd.push function, so it’s not available later in the second inside the div.
    Instead the declaration should be
    _Mrec = googletag.defineSlot(‘/46400095/123_300x250’, [300, 250], ‘div-gpt-ad-1476516294335-0′).addService(googletag.pubads());
    At least this is what worked for me, as the former raised an error of an undeclared variable _Mrec


  3. hello, Abhishek
    We Have Made A Deal With The Direct Advertiser, That We Will Be Using 10 seconds Ads Refresh, We Have Only 2 Slots In The Website, Does DFP Allow Us To Do 10 seconds Refresh. If Not Are There Any Adserver Which Can Help Us

  4. is it possible to refresh after an ad has been “in view” for etc 30 secs or someone has scrolled down the page and then back up the page, so as the ad is back in view and then fires a refresh?

    • Hello Daolm,

      Auto refresh is allowed for both desktop and mobile for AdX demand. It requires custom coding. What you’re seeing is the DFP (Google Ad Manager) feature for in-app mobile inventory.

Comments are closed.