Forum Moderators: martinibuster

Message Too Old, No Replies

Showing local grey squares instead of ads

Simple javascript trick

         

jetteroheller

5:19 pm on Aug 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I insert all my AdSense code by SSI.

The local version on my own computer starts so with

<!--#include virtual="/cgi-bin/ssi.pl?insert=120x90" -->

in the html code.

A javascript at the end of the document can replace this by

<table cellspacing=0 cellpadding=0 border=0 bgcolor=#808080>';
<tr height=90><td width=120>&nbsp;</table>

plasma

6:11 pm on Aug 20, 2006 (gmt 0)

10+ Year Member



What is that good for?

jetteroheller

6:14 pm on Aug 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What is it good for

Ad delivery by SSI

Cetral control of all ad delivery
Marked computers for the family with manipulated user agent string to show only Amazon
Easy to block IP addresses for ad delivery

Javascript exchange of adblocks

Easy to see in the layout whre the ads will be places.

dcheney

6:43 pm on Aug 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Personally I use a slightly more generic method. The downside is I don't see AdSense ads on any site. (To view ads I simply use one of my other computers without this installed.)

First, add a line in the local hosts file like this:
127.0.0.1pagead2.googlesyndication.com

(that simply redirects adsense requests to the local machine)

FYI, the local hosts file under windows is located:
c:\windows\system32\drivers\etc\

(exact location may vary if, for example, windows is installed in a different directory)

Second, create a directory named "pagead" in the root of your local web pages.

In that directory, create a file "show_ads.js" - this will be the javascript executed in place of the adsense ads.

I use this for my "show_ads.js":

document.write('<img src="http://localhost/images/g.gif" width=');
document.write(google_ad_width);
document.write(' height=');
document.write(google_ad_height);
document.write(' alt="Google Ads Go Here">');

All that does is display a local graphic (for me its a big "G") of the correct size whereever the adsense ads would normally appear.