Avoid additional Adsense impression from publisher

It is always a problem for Adsense publishers that always visit their own websites for testing purpose - Google Adsense will report additional Ad impression. The statistic at Google Adsense’s report becomes inaccurate and might affect the overall earning especially when publisher does a lot of testing on his/her own sites. When impression is increased, page CTR (click through rate) will be decreased and as well as eCPM (effective cost per 1000 impression).

Here is the trick to solve the problem:

  1. Create a page (e.g. adsenseCookie.php) that create a cookie where its expiration date is set to a specific date (e.g. 1 day, 1 month or 1 year from now)
  2. In your page’s source code, check whether the cookie is set. If it is, display an image that is same size with the Adsense’s Ad (e.g. 300×250 pixels). If the cookie is not set, display the Adsense code.
  3. When you want to do a testing on your site, simply execute the page adsenseCookie.php once. Then, your website will show you an static image instead of Adsense (Set the cookie’s expiration date to a longer one so that no need to execute adsenseCookie.php every time you want to do testing on your site).
  4. .

Here is an example code for PHP (adsense size 300×250):

Set cookie page


<?php setcookie('TestCookie', 'ForAdsense', time () + 365 * 24 * 3600 ); ?>

Display Adsense code or Image


<?php
if (isset($_COOKIE['TestCookie']) &&
  $_COOKIE['TestCookie'] == ‘ForAdsense’) {
?>
<img src="adsenseImage300×250.gif" width="300" height="250" />
<?php
} else {
?>
<script type="text/javascript"><!–
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300×250_as";
google_ad_channel ="";
//–></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php
}
?>

Share this article

  • digg
  • del.icio.us
  • Fark
  • Furl
  • Spurl
  • BlinkList
  • YahooMyWeb
  • Simpy
  • blinkbits
  • Digg
  • Facebook
  • Google
  • Live
  • Technorati
  • blogmarks

One Response to “Avoid additional Adsense impression from publisher”

  • EngLee
    July 18th, 2005, 10:53 am

    Good post! But too bad, I’m using blogger.

 

Leave a Reply