Welcome to WebmasterWorld Guest from

Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense on blogs on forums

4:49 am on Jul 15, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Feb 12, 2002
posts: 582
votes: 0

Please correct me if I'm wrong, but I believe it is ok to use Adsense on blogs and forums (whether or not much money can be made is a different issue), but just that you can't put adsense code on pages that are just like login.php, register.php, etc. (just making up possible file names here). Is that right?

I don't want to put ads in the middle of blog posts, etc. I want the site to look cleaner. So I want to puts ads at the top of the pages next to the logo. Which I would do by putting the code in my header.php file. That would cause problems though because then the ads would show up on the types of pages I mention above.

So to work around that problem does anyone know if you can just write some php code that would go something like this :

if not register.php, etc., then show adsense ads?

I'm not sure how exactly to write the php or which files I need to exclude yet, but I wanted to find out if 1)it was acceptable to do this and 2)if it was technically possible. Does anyone know or are doing this already? Thanks!
12:35 pm on July 15, 2011 (gmt 0)

Senior Member

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

joined:Feb 12, 2006
votes: 116

you could do something like this

if($_SERVER['SCRIPT_NAME'] != '/forum/register.php') {

echo 'adsense code goes here';


i would be a bit worried about putting ads onto forum posts, though -- although lots of people do do it without any problems. because you can never tell when the discussion will descend into something which adsense frowns upon. You mention that they dont like ads on login pages, but they also dont like ads on pages about gambling and stuff like that. What if your users start talking about the bookies? You'll have to police the forum for all the dodgy subjects.
12:46 pm on July 15, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member netmeg is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 30, 2005
votes: 222

Yes you can exclude - I don't have a forum, but I do have a bunch of WordPress sites, and I don't run ads on my 404 page, my search results pages, my About page or the page where I sell direct advertising, for example.

But londrum's point is well taken - you never know when one stop word entered by a user might turn your ads off.
5:52 am on July 16, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Feb 12, 2002
posts: 582
votes: 0

Thank you very much for the replies - I really appreciate the help and advice!

When I get the forum started, I plan to moderate the forum pretty heavily, and given topic of the site, I can't see any discussions turning into something google doesn't like.

londrum - so the $_server[''] part is literally part of the code I could use to do it with? That's the one part I really wasn't sure of how to write myself.
2:29 pm on July 16, 2011 (gmt 0)

Junior Member from US 

10+ Year Member

joined:Apr 4, 2004
votes: 11

I obviously have no idea what forum or blog software you're running, but on my vBulletin sites (I'm still using the "old" 3.x version) back when I started using AdSense in Jan 2004 I edited the appropriate templates so AdSense would only show up on "content" pages. I wanted to make *very* sure the AdSense folks wouldn't have a complaint. That said, I visit a lot of forums today (not just ones running on vBulletin) which have AdSense showing on every page, even non-content pages. Personally I don't want to take any chances so I keep my forums "clean" (no AdSense on non-content pages).

And while it doesn't (as far as I know) affect AdSense my robots.txt file prohibits indexing of non-content pages such as Register, Attachment, and all the other pages that there is no reason for Google (or any search engine spider for that matter) to spider (why waste their time trying to index non-content pages). E.g.:

Disallow: /Forums/private.php
Disallow: /Forums/profile.php
Disallow: /Forums/register.php
Disallow: /Forums/report.php
Disallow: /Forums/reputation.php
Disallow: /Forums/sendmessage.php
Disallow: /Forums/sendtofriend.php

And yes - You can make money on forums. I cleared over US$100K last year on my main forum alone.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members