If you read about Lorem ipsum ads, you know I wanted to test my website template with live ads but with no risk of invalid impressions and not having to touch the code. The solution of copying the real ads replacing their text with lorem ipsum was good, but I found out something even better! We can display real Adsense ads in our test computers without associating them with our publisher ID!
I've discovered this feature while using the Adsense widget available in the Blogger layout editor. It has a preview tool which displays fully configurable ads with real text and formatting. Exactly what I needed. So I rushed and wrote a simple proxy in PHP that captures the ad requests, strips my publisher ID and returns those Blogger preview ads.
The proxy requests Ads from the following URL (example link, the real one will be customized):
http://pagead2.googlesyndication.com/pagead/ads
?client=ca-google-blogger
&adtest=on
&url=www.google.com
&output=html
&uiv=1
&ad_type=text_image
&format=728x90_as
&color_border=FFFFFF
&color_link=0000FF
&color_url=008000
&color_text=FFFFFF
&color_bg=FFFFFF
Below you can see a real Medium Rectangle vs a faux one in a split test.
Monetizing Ads (pointing to pagead2.googlesyndication.com):
Safe ads (pointing to adsense-proxy.brels.com, use your own after you download):
You can tell if the proxy is working by checking the URL of the links. The monetizing ones will point to Google servers and will have your publisher ID (ca-pub-XXXXXX) embedded in the URL. The safe ones (generated by Blogger through the proxy) will point to the proxy and have Blogger's publisher ID (ca-google-blogger) embedded.
You will also notice that the ads aren't targeted to your website, since the request is made directly to the preview tool by the proxy, which won't provide correct referrer and geolocation information.
Finally, if you don't customize the file show_ads.js with your ad slots colors, you'll get the standard Adsense color palette.
Donwload one of the packages below and configure your server (it may be in your local network or the Internet, it doesn't matter as long as it isn't the same machine that will use the proxy) to receive requests to pagead2.googlesyndication.com. The proxy is tested on Apache only.
Now you have to edit the hosts file of every computer that you wish to have safe ads to make pagead2.googlesyndication.com redirect to the server you just set up.