Lot many webmasters and designers worry about testing a test or offline site with Google Adsense code on localhost. They do test the design changes for many times on localhost which turns into lot many impressions of Adsense ads on the offline or “under construction” site. As per the TOS of Google Adsense, you should not use Adsense code on “Under Construction sites. Adsense Codes should be there on live sites only. In case you accidently click on those served ads while testing the site, it may lead to get Adsense account banned from Google. If you are testing your site locally using WAMP, XAMP, LAMP or any other platform, you should avoid using the Adsense impressions or even code in the template. To avoid the Adsense account ban for these issues, you can try below ways to complete your template, design changes testing.
Use Screenshots of Adsense Ads from Live Site
Best way of testing a site design changes with Adsense layout is to put the screenshot of Adsense ads on the same place where Adsense code is located on live site. If you are planning to add new “Adsense Size” ad then go to any website which is using that layout or your can take screenshot from Adsense Sandbox. This way you can avoid any impression of Adsense ads on test site while testing it.
Install AdBlock Chrome Extension or Firefox Add-on
You should not click on ads running on your own site whether it is a live site or test site. To avoid any hit on localhost sites, you should install “AdBlock” Chrome Extension or Mozilla Firefox add-on. AdBlock blocks advertisements from Google or other network to appear on the browser. So this will also help you ion avoiding any accidental hit on Adsense ads.
Test Template Without Adsense Code
Basic way to avoid any penalty is to remove the complete code of adsense from the site. You can keep the DIV section of the adsense ad area on HTML part. Test your site changes and add Adsense code at the time of upload.
Use “Ozh’ Who Sees Ads” plugin on WordPress Sites
If your test site is on self hosted WordPress platform, then you can use “Ozh’ Who Sees Ads” plugin to control the visibility of Adsense or other ads. Thru this WordPress plugin, you can set the option to avoid any impression of adsense ad on site template to appear while testing. This plugin is having lot many ad visibility option for live sites as well but you can customize it for avoiding any ban from Google for Adsense TOS violation.
Back in 2009, people were used to use google_adtest = "on" for the test sites but now this features is no longer available. As per the TOS of Adsense, Publishers are not allowed to make any changes in the Adsense Code. So don’t use google_test = “on” while testing your site. To avoid penalty or ban from Google for wrong implementation of adsense, use any of above 4 ways while testing your site on localhost.