homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & jatar k & martinibuster

Google AdSense Forum

I Would Like to Be Able to Block Ads by IP
to make working on your own site safer

 9:16 am on Feb 13, 2006 (gmt 0)

This may be a stupid question, but does anyone know why google do not provide a feature whereby you can give them a short list of IP addresses to be discounted from adsense charging and various other metrics.

I know it would only be useful to people who are working from static IP addresses, but it does seem that even very professional webmasters sometimes accidentally click on an ad, and it would be nice to know that you can work on your own pages with impunity.

Supposing someone reported an odd javascript error with a certain browser. You might make hudreds of page views trying to reproduce it and work out exactly what was happening, and that could easily confuse the Adsense 'bot into believing that it was serving up inappropriate ads as the CTR would drop (depending on how popular the page was with the GP).



 11:47 am on Feb 13, 2006 (gmt 0)

It's not a stupid question, and has been asked before, they probably have it on their wish list.


 12:27 pm on Feb 13, 2006 (gmt 0)

Thinking just a bit outside the box here, it is not allowed to modify the Adsense code, but can't you simply surround the unmodified Adsense code with a PHP or SSI conditional include, based on your IP address or hostname?

For example, using a simple Apache Server-Side Include:

<!--#if expr="( ((${REMOTE_ADDR} != /192\.168\.0\.1/) && (${REMOTE_ADDR} != /10\.10\.10\.2/) )" -->

-Adsense code goes here-

<!--#endif -->

Using an "Else" clause, you could also include image placeholders for the suppressed ads, if their absence would otherwise throw off your page layout.

The technical approach is, I think, sound, but I am not sure about the answer to the "Is this allowed" part of the question. If used only to suppress ad serving to your own IP address, I would think this allowable, and in fact, undetectable.



 12:38 pm on Feb 13, 2006 (gmt 0)


I've been using a similar system for the last 12 months without problem, selectively displaying Ads based on a set criteria. There's nothing in the AS TOS to say you can't do that.

In a thread I had in here (somewhere) about "rotating Ads", AdsenseAdvisor posted and certainly didn't complain. In fact, he/she welcomed the line of thinking.

In my particular case, it was about not showing ads to regulars all the time, but the process is identical.

You could drive this quite easily from a DB and have a blacklist of IP's.



 2:34 pm on Feb 13, 2006 (gmt 0)

adsonar/quigo have had just such a system for as long as I can remember (18+months) Maybe they just have better algorythmists than Google has. Alternatively maybe they care more, alternatively ... (time for the G cheerleader brigade to step in)


 9:10 pm on Feb 13, 2006 (gmt 0)

<!--#if expr="( ((${REMOTE_ADDR}!= /192\.168\.0\.1/) && (${REMOTE_ADDR}!= /10\.10\.10\.2/) )" -->

-Adsense code goes here-

<!--#endif -->

what is the maximum ip addresses I can ban with this script?


 9:28 pm on Feb 13, 2006 (gmt 0)

I have an office at home, and we occasionally have guests coming to stay to whom we give internet access via our network - using the same IP as the one I use to upload pages and check Adsense stats.

I really hate having to give each guest a mini-training course on what an adsense ad looks like, and why they shouldn't go to my website and click on one. In fact, most of the time they look at me as if I'm a bit deranged, especially the ones who aren't as computer literate as the rest of us.

This week I'm away and a couple are coming to stay with my wife and son. I'm not going to 'provide any training' because I'll be gone by the time they arrive, so I'll have to cross my fingers that nothing happens whilst I'm away.

Please, ASA, can't we have an "ignore these IP addresses" feature?

"Pretty please"?

It'd help cure my insomnia :-)


 9:57 pm on Feb 13, 2006 (gmt 0)

Hosts file. Hosts file. Use the hosts file.

[added]Unless they use their own laptop, in which case you're back to detecting your own IP block from the server.[/added]


 10:08 pm on Feb 13, 2006 (gmt 0)

jomaxx wrote:
Hosts file. Hosts file. Use the hosts file.

Good idea. Third good idea in the last two days. This forum is flowing with them!

Having said that, I don't know much about host files, but they are on the PC are they not? If so, this is useful in most but not all circumstances, I think.

I want to be able to see the ads from my computer (to monitor what appears). But guests have a separate logon to our network, so I presume that I can set up a separate hosts file for those that logon as guest, so that particular problem is solved.

But another problem (relevant for me this week) is the guest bringing their own laptop and connecting to my dsl modem/wireless network. The relevant hosts file is on the laptop, is it not? This isn't so much of a problem, because laptop-owning guests tend to be pretty computer-literate, but it would be good to find a more permanent solution and avoid having to go through the mini training course!


 10:15 pm on Feb 13, 2006 (gmt 0)

See, this is a perk of condo life as I have a few neighbors that have insecure wireless networks running and I can just let the guests use those instead.

Like I'm giving out my WAN security codes to guests...


 10:18 pm on Feb 13, 2006 (gmt 0)

Darn, I knew moving into a nice detached house with a bit of land was a mistake. And those owls keep me awake at night!


 10:43 pm on Feb 13, 2006 (gmt 0)

And those owls keep me awake at night!

Now I know where my owls went! Send them back please.

Sorry for being OT, I'm just bored today and lacking caffeine.

Jordo needs a drink

 10:52 pm on Feb 13, 2006 (gmt 0)

It looks like jdMorgan gave you the solution if you use apache... Unless it's an issue that you'ld have to edit every page you have adsense on.

The server side include he posted earlier will stop the adsense from being displayed to the ip address you don't want it displayed to.

But, I agree, we should be able to tell google which IP's not to count.


 11:06 pm on Feb 13, 2006 (gmt 0)

> what is the maximum ip addresses I can ban with this script?

I wouldn't care to use this to exclude more than a handful of IP addresses... Maybe ten.

But you might get the results you want by excluding IP ranges, for example -, by specifying only a partial address. In that way, you could exclude several entire blocks of addresses without making the code ugly and hard to maintain, and without too much code-bloat.



 11:11 pm on Feb 13, 2006 (gmt 0)


Yes, the hosts file is on the individual PCs -- typically at C:\WINDOWS\SYSTEM32\DRIVERS\etc on an XP machine. As such it's not really a very good solution if you have people popping in and out with their own laptops. It's also a "per-computer" setting, and not a "per-user" setting. Instead of the "don't click ads" speech, you'd have to walk them through modifying their hosts file...


Global Options:
 top home search open messages active posts  

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved