Ads are for Googlers

In my last post, I mentioned that I needed the Comment Author cookie for something else I was doing. My decision to do this came about after leaving a comment over at Binary Bonsai.

OK, I’ll start from the beginning… I was listening to Michael’s (Binary Bonsai) podcast, and he mentioned something about having Google ads on the site. I was surprised to hear this because I couldn’t remember seeing any Google ads on his site. I went and left a comment on his Podcast #3 post, asking about google ads. Michael replied by saying:

“The ads disappear the moment you leave a comment. No need to hassle my regulars with ads, that’s for the googlers :)”

I thought… Cool! I like that. How do I do that? Well, luckily Michael was kind enough to share his code. Basically, it works by looking for the comment author cookie, and hiding the google ads if it finds it. Thanks Michael!

So, if you’ve left a comment here recently, you should be seeing the site without Google ads. If you’re new, or a lurker, then you are seeing the ads. But, just leave a comment and they should go away. There is one caveat to this though… I’m using the WP-Cache plugin, to help speed up the rendering of the pages that get a lot of hits. I think sometimes the ads get cached, so if you don’t see them disappear immediately after making a comment, they should go away within the next visit or two,

1 thought on “Ads are for Googlers”

  1. Paul that is an awesome find. Wonder if I can pull something like that off with blogger – doubt it since I’m not running my own software or server. Heck I’m not even running ad-sense yet. I’ve been reluctant since, well, I get no hits and I figure “what’s the point?” at this point. Anyway, great find.

Leave a Comment