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 pared to Adsense.
My current Adsense code:
<script async src="//pagead2.googlesyndication/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>
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 pared to Adsense.
My current Adsense code:
<script async src="//pagead2.googlesyndication./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>
Share
Improve this question
asked May 18, 2015 at 2:22
DaveDave
29.1k26 gold badges115 silver badges184 bronze badges
2 Answers
Reset to default 12AdSense'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:
- General Tutorial #1 (Outdated, but still useful)
- General Tutorial #2 (Also outdated, but useful nonetheless)
- 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
Add this code after the start <head>
tag
<script async src=”//pagead2.googlesyndication./pagead/js/adsbygoogle.js”></script>
<script src=’http://connect.kyowal./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./rsiwal/posts/8702