Reloading or refreshing your AdSense advertisements automatically isn’t allowed by Google. Probably you only intend to refresh the ad in response to user action Google still does not allow that.

The reason to update advertisements is to show new ones. Maybe new ones will be interested to the user and they make a click that brings you some cash. I think you do nothing wrong by reloading the ads in response to use action.

Displaying an ad is called an “impression”.  Reloading ads will automatically trigger an impression.  If you don’t want to make fake impressions and all you want is your ajax based website (that unfortunately does not reload the page) to reload ads when user visits different sections of your website. Here is a small tip:

Create a div wrapper around javascript ads:

<div id="ad-container">
 
	... google ads javascript here ...
 
</div>

In response to user action call javascript below:

<script type="text/javascript">
//define ads element
var ads = document.getElementById("ad-container");
//ad parent node
var prn = ads.parentNode;
//lets clone ads block
var cln =  ads.cloneNode(true);
//remove the current ads block completely
prn.removeChild(ads);
//append a newly cloned one
prn.appendChild(cln);
</script>

Dima Svirid

Software architect. Ajax/Javascript, HTML5, Android, iPhone/iPad, JAVA, PHP, Cold Fusion, SQL, Air, Flash, Open source software, Frameworks

More Posts

Follow Me:

Tagged with:
 

One Response to Reload Google ads with Javascript

  1. doesn't it violate Google TOS?

Leave a Reply