Google AdSense for search - Posted (1878 Views)
Average Member
Webbo
Posts: 982
982
To add a Google searchbox into your forum's search page as part of the Google Adsense program...
Create a new asp file with the following code and name it - inc_google_search.asp

_______________________________________________________________________________
Code:
<%  
Response.Write " <br><br> " & vbNewLine
Response.Write " <form method=""get"" action=""http://www.google.com/custom"" target=""_top""> " & vbNewLine & _
" <table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td nowrap=""nowrap"" valign=""top"" align=""left"" height=""32"">" & vbNewLine & _
" <a href=""http://www.google.com/""><img src=""http://www.google.com/logos/Logo_25wht.gif"" border=""0"" alt=""Google"" align=""middle""></img></a>" & vbNewLine & _
" <input type=""text"" name=""q"" size=""31"" maxlength=""255"" value=""""></input>" & vbNewLine & _
" <input type=""submit"" name=""sa"" value=""WebSearch""></input>" & vbNewLine & _
" <input type=""hidden"" name=""client"" value=""pub-YOUR_ID_HERE""></input>" & vbNewLine & _
" <input type=""hidden"" name=""forid"" value=""1""></input>" & vbNewLine & _
" <input type=""hidden"" name=""ie"" value=""ISO-8859-1""></input>" & vbNewLine & _
" <input type=""hidden"" name=""oe"" value=""ISO-8859-1""></input>" & vbNewLine & _
" <input type=""hidden"" name=""cof"" value=""GALT:#339933;GL:1;DIV:#663333;VLC:FF6666;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:67;LW:193;L:http://www.YOURSITE.com/YOURLOGO.gif;S:http://www.YOURSITE.com;LP:1;FORID:1;""></input>" & vbNewLine & _
" <input type=""hidden"" name=""hl"" value=""en""></input>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </form>" & vbNewLine
%>

______________________________________________________________________________


Please Note:
In Line 10 you need to add your ID Number
In Line 14 of the above you will need to add the link to your website logo and also your website
The color variables can also be altered to change the text and background colors if required


In your search.asp file find the following (about line 639)
____________________________________________________________________________
Code:
end if 
____________________________________________________________________________

and after it add the following: ____________________________________________________________________________
Code:
%> 
<!--#INCLUDE FILE="inc_google_search.asp"-->
<%
____________________________________________________________________________


It's relatively easy to do :)

Webbo
<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Starting Member
corinaw
Posts: 22
22
Hello webbo,
I tried this, and it does work, but the google search box on my site is black- (even though I specified a white background in the google code)

The major issue I have is that the code inserts right in between the two blue boxes in search.asp, right after the search for, and before the search in.
Is there a way to make this work was where the google search for is the first one up? Thanks very much for any assistance.

corina
<
Posted
Support Moderator
Podge
Posts: 3776
3776
DO you have a link to your search page? You could include the inc_google_search.asp file anywhere on the search.asp page.<
Posted
Average Member
Webbo
Posts: 982
982
It sounds like you've added the following code in the wrong place in your search.asp file

%>
<!--#INCLUDE FILE="inc_google_search.asp"-->
<%

Can you show us a link to your search page or a text version of your search.asp file?<
Posted
Starting Member
corinaw
Posts: 22
22
Hi Podge,
Thanks for the reply. I've tried several times to reposition it, and I get an error, such as unexpected end statement, or something like that. Unfortunately I'm FAR away from being an asp pro, so it's not really clear to me where I can put the code ;)

I just loaded the current version of the forum so the code and settings are all (mostly) default- I was thinking the instructions webbo listed could have been for the prev version. As I mentioned the background was black, but I was able to change the settings and fix it.
I also noticed (w/ mod) I get a listing of all the forum categories right afer the search box (House Cleaning Tips Stain Removal Start a House Cleaning Business) It does not do that w/o mod, so I'm concerned maybe it breaks something else.

Looking at the html of the current page, I see this code below right under the google search box, so I'm pretty sure it's breaking something else too. <option value="1">House Cleaning Tips</option>
<option value="2">Stain Removal</option>
<option value="3">Start a House Cleaning Business</option>

If you can take a look and give me some advise on getting the google search first, above both the blue boxes I'd really appreciate it!
http://www.mrscleannw.com/forum/search.asp<
Posted
Average Member
Webbo
Posts: 982
982
Here's a link to my search page Click Here
Can you post a link to a txt version of your search.asp and I'll reposition your google code for you<
Posted
Starting Member
corinaw
Posts: 22
22
Hi Webbo.
<edit> sorry here is a copy of search.asp in text format </edit>

http://www.mrscleannw.com/forum/search.txt

Thanks very much!!<
Posted
Average Member
Webbo
Posts: 982
982
Here you are: search.ap
Rename your original search.asp file to something like search1.asp and upload the one in the zip file instead
Any problems let me know

<
Posted
Starting Member
corinaw
Posts: 22
22
Thanks very much Webbo! I got it placed just fine.
Regards,
corina<
Posted
Junior Member
wildfiction
Posts: 167
167
Thanks Webbo - that's very useful.
I had a look at your forum and I see that it needs another mod. The reason that I say that is because I also need to add a mod but haven't got a chance to writing it yet.
Reason: I notice that AdSense ads for Snitz Skis appear on your forum. This is because when Google parses your page it picks up the text "snitz" on the page. Now if we wrapped the following code:
<!--google_ad_section_start-->
<!--google_ad_section_end-->
around the subject and body text then Google will give the most emphasis to that text when deciding what types of ads to display. In other words - better targeted ads for your forum.
If I get a chance this weekend I'll look at doing the mod - otherwise if someone wants to suggest where I start that would also help.<
Posted
Average Member
Webbo
Posts: 982
982
Okay Wf, I'll look out for it<
You Must enter a message