Forum Moderators: martinibuster

Message Too Old, No Replies

Is it possible to exclude my IP from Adsense?

Working on site attributes too many clicks to myself

         

flobaby

6:35 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



Is there an option to do this? It's my first site using adwords and I feel like I'm wasting click counts.

lammert

6:51 pm on Jan 21, 2005 (gmt 0)

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



If I understand you correct, you want to disable advertisments on pages when they are viewed from your computer. This will reduce the number of impressions, not the number of clicks (I hope you don't click on your ads).

If you are using server side includes (SSI), you could place the google code in an include file, say /includes/google.inc. Then you add the following code to each of your .shtml files where you want to use the google advertisments:

<!--#IF EXPR="$REMOTE_ADDR!=10.0.0.1" -->
<!--#INCLUDE VIRTUAL="/includes/google.inc" -->
<!--#ENDIF -->

You need to replace the IP address 10.0.0.1 with your own public IP address.

flobaby

7:05 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



Pefect (and yes, sorry about that, I meant impressions...I'm a non-clicker from way back).

Great fix, thanks!

Chndru

10:27 pm on Jan 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is there a way to modify host files to prevent AS displaying on my computer?

Thanks..

lammert

10:48 pm on Jan 21, 2005 (gmt 0)

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



What are "host files" if I may be so kind to ask?

ve3cnu

1:33 am on Jan 22, 2005 (gmt 0)

10+ Year Member



a file name "hosts" resides on most unix systems under /etc

Windows has something similar I'm sure.

It is a local, hard-coded domain to ip address resolver. I don't think this would work though, because adsense works inside javascript.

homeblock

4:22 am on Jan 22, 2005 (gmt 0)

10+ Year Member



Here is the PHP version of the above code:

<?PHP
if ("24.235.XXX.XXX"!= $_SERVER['REMOTE_ADDR']) {
include "/includes/google.inc"; }
?>

Just replace 24.235.XXX.XXX with your IP. If anyone wants I could rewrite to block your entire subnet ie 24.235.46.* or to block multiple IPs.

lammert

1:54 pm on Jan 22, 2005 (gmt 0)

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



You can add one line in the /etc/hosts or c:\windows\system32\drivers\etc\hosts (for Windows) to redirect all calls to the google ad server to your local computer. This line is

127.0.0.1 pagead2.googlesyndication.com

Thanx for the idea Chndru and Ve3cnu, I didn't think of this option my self. You don't even need to change your site's source code to achieve the desired effect.

Drawback is, that you do not see the ads on other sites either...