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

Got email off google.. need to remove ads from search, login and
register page. Javascript help please!

 7:01 pm on Mar 22, 2004 (gmt 0)

Hey all, ive recieved an email from google saying im not allowed my banner on my search, register and login page.

Problem is, my website is a forum which uses a global header. So the adcode is in there and automatically gets put on the register login and search page.

Here are the pages I DONT want the code on..
So, Id like some javascript to go around the banner code something along the lines of..

If ((url = register_page) OR (url = login page) OR (url = search page))
dont do anything
google ad code in here

Can anyone help with this, I thought about getting the URL, and checking to see if charat wherever the R for register in the url should be is an R.. etc..

Hope you understand,




 7:07 pm on Mar 22, 2004 (gmt 0)

Why not exclude in the php by checking the act parameter?


 7:19 pm on Mar 22, 2004 (gmt 0)

Check out the support site for the forum software you run - chances are, this has been discussed and can tell you what files to edit, rather than using the header for AdSense inclusion.


 7:22 pm on Mar 22, 2004 (gmt 0)

Im not quite sure what you mean, I have pasted the ad code into my forum header (its a 'skin' so it only allows you to edit the html to display the page, and none of the internal php which makes the forum tick).

Seeing as I have removed my google ad until I get it sorted, you may as well have a look -


The advert is 'hard coded' into each and every page automatically as its the global header.

Cheers for the reply but I dont quite understand :S

[edited by: Jenstar at 4:21 pm (utc) on Mar. 23, 2004]
[edit reason] NO URLS as per TOS, please! [/edit]


 9:24 pm on Mar 22, 2004 (gmt 0)

Ok, got it sorted, just incase anyone else is interested.. heres the code.
Basically looks for the words 'search', 'reg' and 'login' in the url, and if it DOESNT it displays the ad. Cheers for the suggestions.

<script language='JavaScript' type='text/javascript'>

var url = window.location.href;

if ((url.indexOf("Search")!= -1) (url.indexOf("Reg")!= -1) (url.indexOf("Login")!= -1))
google code.


 9:37 pm on Mar 22, 2004 (gmt 0)


I do not want to cause a panic for you, but it looks to me that you have changed the AdSense code!

I'm not sure if you are aware of this, but you are not allowed to do this!

Your AdSense code looks like this to me (and I guess all others who look at it!)

<script type="text/javascript"><!--
google_ad_client = "pub-REMOVED";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as";

It also looks like you are missing the


[edited by: Noel at 9:51 pm (utc) on Mar. 22, 2004]


 9:39 pm on Mar 22, 2004 (gmt 0)

Here is how my site is layed out somewhat, and how I do this:

Lets look at my login page:

$googlead = "off";

content here....
content here....
content here....

<? include('footer.php');?>

Now lets take a look at my header.php:
content here....
content here....
<?php if($googlead!= "off") {
display google ad

That's how I do it, somewhat.. and it works great.


 9:40 pm on Mar 22, 2004 (gmt 0)

Wait a minute -- I thought the new TOS said you COULD have Adsense on search results?

Anyone clarified this with Google, or should I email them and ask?


 8:25 am on Mar 23, 2004 (gmt 0)

Anyone clarified this with Google, or should I email them and ask?

Yes, you are allowed to have ads on internal search results. I emailed some time ago and got a positive response.


 9:01 am on Mar 23, 2004 (gmt 0)

Really? I've held off putting AdSense on my inhouse search results just because of the restriction.


 9:09 am on Mar 23, 2004 (gmt 0)

Yes, and I believe the new TOS already reflects this, or at least it doesn't say it's not permitted.


 9:26 am on Mar 23, 2004 (gmt 0)

The Program Policies still say (under Ad Placement) that ads must not be displayed on any registration pages. There is no longer a mention of search pages, though, and I distinctly recall reading somewhere that it was now explicitly allowed. (Perhaps it was in one of Jenstar's summaries, but I can't find it right now.)


 4:23 pm on Mar 23, 2004 (gmt 0)

It is no longer a TOS/policy violation to put AdSense on internet search pages (search pages that only display results from your own page).

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