8.5. AdSense Search Settings
To get the code for placing a search box on your web pages, click the Search Settings tab followed by the Search Code link. On the Search Code page, enter your site language from a drop-down list and select your country.
8.5.1. Web Search Boxes
To add a web search box, make sure Google Search is selected, as in Figure 8-19. There are a few simple choices you can make about the layout of your search box, and you can also decide to exclude adult content from searches by enabling SafeSearch. When you are satisfied with your search box selections, click Update Code.
Figure 8-19. Google web search boxes give you some layout choices, along with the possibility of filtering adult content from your searches
8.5.2. Site Search Boxes
The site search box is a nifty alternative to Google's web search box. You can set this box up in a number of different ways, depending upon the options you choose:
Google can only return results from pages it has indexed, so the site search box results of your domains will only be as good as Google's job of indexing your site.
To implement a search box, choose the Google SiteSearch radio button (rather than the Google Search button), as shown in Figure 8-20.
Next, enter the domains you would like the ability to search (from one to three, separated by semicolons). Make your selections of graphic elements, and click Update Code.
Figure 8-20. You can include up to three domains as sites to search
8.5.3. Getting Simple Search Code
Scroll down to the bottom of the Search Code page, and select and copy the Google search box code. For example, for a site search box, the code would look more or less like this:
<!-- SiteSearch Google --> <form method="get" action="http://www.google.com/custom" target="google_window"> <table border="0" bgcolor="#ffffff"> <tr><td nowrap="nowrap" valign="top" align="left" height="32"> <a href="http://www.google.com/"> <img src="/books/2/226/1/html/2/http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google"></img></a> </td> <td nowrap="nowrap"> <input type="hidden" name="domains" value="www.braintique.com ; www.digitalfieldguide.com ; www.googleplexblog.com"></input> <input type="text" name="q" size="31" maxlength="255" value=""></input> <input type="submit" name="sa" value="Search"></input> </td></tr> <tr> <td> </td> <td nowrap="nowrap"> <table> <tr> <td> <input type="radio" name="sitesearch" value="" checked="checked"></input> <font size="-1" color="#000000">Web</font> </td> <td> <input type="radio" name="sitesearch" value="YOUR DOMAIN NAME"></input> <font size="-1" color="#000000">YOUR DOMAIN NAME</font> </td> </tr> </table> <input type="hidden" name="client" value="pub-XXXXXXXXXXXX"></input> <input type="hidden" name="forid" value="1"></input> <input type="hidden" name="ie" value="ISO-8859-1"></input> <input type="hidden" name="oe" value="ISO-8859-1"></input> <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699; ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;"></input> <input type="hidden" name="hl" value="en"></input> </td></tr></table> </form> <!-- SiteSearch Google -->
As you can see, internally the site search box is implemented as an HTML form and table. If you copy this code into your web site, you'll see a search box that allows you to search the Web (or specific domains) like the one shown in Figure 8-21.
Figure 8-21. With a site search box, users can search the Web, or the specific domains you chose
If your site visitors use this box to search the Web or your domains, the page that Google returns will carry ads that are contextually relevant to the search. If the visitor clicks on one of them, you'll make some money.
8.5.4. Working with Search Styles
Google has made some effort to help you customize the search page that visitors see when they search using the Web or site search boxes. After all, in some sense the search results pageparticularly if you are using site search to search through your own domainis an extension of your content, even if Google is serving it.
To customize the search results page that visitors will see when they use your Google search or site search boxes, click the Styles link on the Search Settings tab to open the Search Styles page.
On the Search Styles page, choose a built-in palette as the starting place, and select a color for each element of the page (Figure 8-22).
Figure 8-22. You can pick the color scheme for your search results page
Next, you can specify a logo (by location) to appear on the search results page (see Figure 8-23). This logo can be used to click back through to your site, so it's a good thing to provide, because it helps you keep control of your traffic.
Figure 8-23. The search results page template is saved as a "palette"
Finally, name and save the scheme for the search results page (Figure 8-24).
Your custom palette will now appear on the list of palettes in the Search Code page (Figure 8-24). Select it, and click the Update Code button to get the new code for your search box. Copy and paste the code into the code in your web pages.
Figure 8-24. The custom palette appears in the Search Code page list of palettes
Now, when visitors use the Google web or site search box, the results page that they see will be customized with your choice of colors and, if you specified one, your logo (see Figure 8-25).
Figure 8-25. With the custom palette selected, your color scheme and logo are used to create the search results page