10

I've found a number of sites that explain how to make a DFP ad reload/refresh after 30-120 seconds, but none of them explain if it's possible to do with an Adsense ad.

I've tried DFP - it's very confusing compared to Adsense.

My current Adsense code:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- MYSITE- Responsive - #1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-123456789..."
     data-ad-slot="123456789"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

2 Answers 2

12

AdSense's TOS disallow the sort of automatic refreshing you're referring to. This does not mean that you cannot automatically refresh AdSense Tags programmatically. It does mean that you will almost certainly get banned for doing so.

On the other hand, this behavior is allowed when using AdSense + Doubleclick for publishers (DFP). This documentation should point you in the right direction, and you'd want to call something like this to refresh your ads:

googletag.pubads().refresh();

The following tutorials should give you enough information to figure out how to use AdSense + DFP:

  1. General Tutorial #1 (Outdated, but still useful)
  2. General Tutorial #2 (Also outdated, but useful nonetheless)
  3. Linking AdSense + DFP (This doesn't work if you're using DFP for Small Business; instead, you'll just want to add you Adsense embed code as a third-party creative

If you are adamant about automatically refreshing ads without DFP, you could do the following wrapped in a timer function:

document.getElementById('FrameID').contentWindow.location.reload(true);

Be advised: This will get you banned from AdSense if you are not using the service through DFP

5
  • So you aren't allowed ("can't") do it with just Adsense, but you can if you use Adsense through DFP?
    – Dave
    May 18, 2015 at 2:50
  • @Dave see my clarifications above, and good luck. Setting up AdSense + DFP with automatic refreshes isn't a terribly simple process.
    – grill
    May 18, 2015 at 4:00
  • Cool thanks for the details! I do want to be "legit", so I guess I'll have to suck it up and get used to DFP. Appreciate the answer and details.
    – Dave
    May 18, 2015 at 4:00
  • It's not clear, but maybe AdSense autorefresh is allowed as long it's user initiated. See: support.google.com/adsense/answer/1346295#Auto-refreshing_ads . It says: "Publishers are not permitted to refresh a page or an element of a page without the user requesting a refresh." So if user interacts with website, is ad refresh allowed?
    – szymond
    Oct 26, 2020 at 18:07
  • @szymond did you figure that out? I need to refresh the ad, when a user clicks on next, even though I'm not refreshing the site, just the content. I think that would be what you are referring to.
    – lpares12
    Mar 28, 2022 at 17:45
0

Add this code after the start <head> tag

<script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script src=’http://connect.kyowal.com/kp_dev/developer/refresh.js’ type=’text/javascript’/>
<script>
var adsenceblockone = ‘<ins class=’adsbygoogle’ data-ad-client=’ca-pub-1385863686986530′ data-ad-format=’auto’ data-ad-slot=’5134528809′ style=’display:block’/>‘;
</script>

Place this code where you want to show your ads on page

<div id=”adsrefreshone”></div>
<script>
adsencerefreshone();
</script>

This code will work only for one advertisement

if you like to show more ads Read the full post here http://www.kyowal.com/rsiwal/posts/8702

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.