Tải bản đầy đủ (.pdf) (18 trang)

Putting Google Search on Your Site

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.09 MB, 18 trang )

Chapter 5
Putting Google Search
on Your Site
In This Chapter

Understanding the seven ways of putting Google on your site

Getting the search code and putting it on your pages

Customizing Google search results to match your site

Building your own Google site
T
he simplest and most identifiable method of partnering with Google is to
incorporate Google searching on your site. You may offer Google search
to your visitors free of charge (to them and to you), and you may customize
the search to a reasonable degree. Giving your users options to search the
Web or your site (or other specific sites) is fairly easy.
Google offers four free search services and three paid services:
ߜ Google Free. A Google-branded search box that delivers Web results.
ߜ Google Free SafeSearch. Same as Google Free, but delivers edited
search results free of adult content.
ߜ Google Free Web and Site Search. An enhanced version of Google Free
with an added option to search only your site or only another site
selected by you.
ߜ Customized Free Web (and Site) Search. With or without the Site Search
option, free customization is available to registered users, enabling them
to display search results under their site’s logo and with their site’s
colors.
ߜ Silver and Gold Search. Two paid search service plans for sites con-
ducting millions of searches per year.


ߜ Custom Web Search. The highest level of paid search, for extremely high-
traffic sites. ISPs and publishers such as EarthLink and the Washington
Post are two clients of Custom Web Search.
09_571435 ch05.qxd 5/21/04 11:30 PM Page 83
This chapter describes the free services. See Chapter 15 for information
about Google’s premium services.
Offering Google searches from your site doesn’t build business in the sense
of directly increasing revenue. Any financial benefit derives indirectly from
making your site more attractive and useful to your visitors.
By the same token, adding a Google search box on your site doesn’t make
your site more likely to be crawled (or more thoroughly crawled), and it
doesn’t improve your PageRank. However, adding Google Free indirectly
enhances your site and makes it more magnetic, if searching is of value to
your users. In particular, using Web and Site Search might be the simplest
way to offer a search engine for your own content.
Terms and Restrictions
Most public Web sites are eligible to host a Google search box. Remember,
though, that you’re hosting only the search box, not the search results. The
box resides on your page, but when visitors launch their searches, they’re
taken to Google to see the results. In the uncustomized version of Google
Free, the results look just as they do when you start a search from Google,
because they are the same. Even fully customized searches are not displayed
on your site, even though they’re designed to look as though they are.
In using Google Free, you’re giving your visitors an easy way to leave your
site. The search results page doesn’t provide a link back to your site, and
there’s no way to place such a link. You can, however, force the results page
to open in a new browser window, leaving your visitor anchored at your site
in the first window. (I explain how later.) Of course, if a visitor restricts the
search to your domain (with the Web and Site Search), the search results are
filled with links back to your site. Indeed, this scenario is one of the most

attractive aspects of using Google Free.
Right now you might be thinking, “Ah, well, I’ll strip out the Web search and
just offer in-site search.” It’s a clever thought, but you would find the HTML
code uncooperative. The Web search option can’t be removed.
Despite all these considerations, offering Google search is an attractive
option to many sites for many reasons. Nearly all types of sites, from per-
sonal to commercial, are eligible. Terms of Service (TOS) do apply to Google
Free, but Google doesn’t insist on a digital agreement from you before getting
started. The TOS is far less compelling than a Harry Potter book, and to save
you the trouble of perusing it, the following items summarize its main points:
84
Part I: Meeting the Other Side of Google
09_571435 ch05.qxd 5/21/04 11:30 PM Page 84
ߜ No frames, mirrors, or cache. Google doesn’t want you appropriating
the search process technically or prohibiting the results from being dis-
played on a Google-served page. You also are not allowed to capture the
results, store them in a database, or otherwise take ownership of them.
The ban against mirror sites (replicated site at various locations) is an
extension of Google’s identical stricture against them in the Web index.
ߜ Monogamy, please. Google is a demanding partner. You may not place
another company’s search box on the same page with Google’s. This
requirement is widely ignored.
ߜ Accept Google, accept its ads. Google displays advertisements on
nearly ever search results page, including the ones appearing on your
site. That’s because these results aren’t on your pages. So don’t think
that you’re going to provide your visitors with an ad-free experience.
ߜ Keep it clean. Google doesn’t want to be associated with illegal sites,
domains that propagate copyright infringement, adult sites, or sites that
sell alcohol or tobacco to minors.
ߜ Be nice to Google. Don’t say mean things about the company that’s pro-

viding free use of its logo and search engine.
ߜ Google doesn’t know you. Don’t pretend that Google is affiliated with or
endorses your site’s content.
ߜ Obey logo laws. Several bylaws apply to the Google logo. Don’t draw on
it, even though Google does. Likewise, don’t take archived logo variations
from Google’s site and use them with your search box. Don’t distort the
logo by squishing it or stretching it. (You may choose from a selection of
sanctioned sizes and colors, though.) Surprisingly, you must not allow
Google’s logo to be larger or more prominent than the site logo — Google
doesn’t want anyone to mistake your dog-and-pony show for the true,
majestic Google site.
ߜ Google can cut you off. As with all TOS agreements, the provider
(Google in this case) can end this collaboration at any time.
The ads Google serves on search pages launched from your site aren’t pub-
lished by you, and they’re not AdSense ads. There’s no benefit to you if one
of your visitors clicks them, because that person is no longer your visitor.
Once that person is off your site, he or she is Google’s visitor, and Google
receives the full benefit of ad clickthroughs. Offering Google Free shouldn’t
inhibit you from considering becoming an AdSense publisher (as described in
Part III). By working both sides of the fence, you get the benefit of users click-
ing through ads placed on your pages, while offering visitors the convenience
of Googling from your site.
85
Chapter 5: Putting Google Search on Your Site
09_571435 ch05.qxd 5/21/04 11:30 PM Page 85
I strongly suggest that if you add Google Free to your site, you go the whole
route with Web and Site Search, fully customized for your site. The ability to
search your own domain and present search results in the color scheme of
your site (complete with logo) distinguishes Google Free from other ways of
initiating a Web search from your site. Without those features, Google Free is a

less compelling way of searching than using the Google Toolbar, which offers
your visitors one-click searching from your site and any non-Google site.
Getting Your Code
With a bit of HTML savvy (just the ability to cut, paste, and upload HTML
documents to your site’s server), you can be hosting Google searches in min-
utes. Registration is not required for basic Google Free, but if you want to
customize the search results, Google needs to know who you are and where
your domain is.
Google Free is installed on your page by means of a small chunk of HTML
code. No JavaScript is involved. The snippet is a simple form, comprising the
Google logo (which is called from a Google server, not stored on yours), a
keyword entry box, a search button, and (in the case of Web and Site Search)
radio buttons that toggle between search domains. (See Figure 5-1.)
Figure 5-1:
Google’s
Web and
Site Search
is free and
easy to
install.
86
Part I: Meeting the Other Side of Google
09_571435 ch05.qxd 5/21/04 11:30 PM Page 86
1. Go to the search code page here:
www.google.com/searchcode.html
2. Scroll down the page to the first code sample, and copy the entire
sample to the Clipboard.
Highlight the sample with your mouse, and then press Ctrl+C. Figure 5-2
shows the code after it is highlighted.
3. Paste the code into the HTML document representing your Web page.

Methods differ widely at this point. You can use any text processor, such
as Windows Notepad, to paste the code. Or you can use an HTML text
generator, which highlights different types of HTML tags, making the
code easier to navigate. Or use the HTML portion of a graphic Web-page
editor such as Dreamweaver. However you do it, you need to choose
where you want the search box to appear on your page, and position the
code to make that happen.
4. Upload the new HTML document for your page to its place on your
site server.
5. Visit your page to see the results.
Depending on your software, you might be able to view the result before
uploading and make adjustments.
Figure 5-2:
Highlight,
copy, and
paste
Google’s
free HTML
code to
install
Google Free
search.
87
Chapter 5: Putting Google Search on Your Site
09_571435 ch05.qxd 5/21/04 11:30 PM Page 87
SafeSearch is a Google searching option that blocks Web pages containing
explicit sexual content from appearing in search results. To install a
SafeSearch box, follow the same steps but in Step 2 scroll further down the
code page to the SafeSearch HTML. The search box appears on your page
with the Google SafeSearch logo attached (as shown in Figure 5-3).

Free Web and Site Search
If you choose Web and Site Search, you need to alter the preset HTML code a
bit, tailoring it to your Web site. The basic appearance doesn’t change much,
but you need to plug in your site’s domain information. Otherwise, Google
won’t know how to offer visitors the option of limiting a search to your site.
Follow these steps:
1. Go to the search code page:
www.google.com/searchcode.html
2. Scroll down the page to the last code sample, and copy the entire
sample to the Clipboard.
3. Paste the code into the HTML document representing your Web page.
You may paste it anywhere in your HTML document. Google allows the
search box to appear anywhere on the page.
4. Change the first two instances of YOUR DOMAIN NAME to your actual
domain address, including the http:// prefix.
There are three instances of YOUR DOMAIN NAME. In the first two, type
your Web address, as in . (That one’s mine. Type
in yours.)
5. Change the third instance of YOUR DOMAIN NAME, to the name you
want to appear on your page.
In Figure 5-1, note that instead of typing www.digitalsongstream.com, I
typed Digital Songstream. I preferred using the name of the site, rather
than the address of the site. Type whatever you want your visitors to see.
6. Upload the new HTML document for your page to its place on your
site server.
Figure 5-3:
A Google
SafeSearch
form.
88

Part I: Meeting the Other Side of Google
09_571435 ch05.qxd 5/21/04 11:30 PM Page 88
You can specify more than one site in which to constrain searches. However,
you must always include a search option for the entire Web. In addition to the
entire Web and your own site, you may include any other public Web site. I
cover multiple domains in the “Customizing Search Results” section of this
chapter.
Tweaking the search form
Before moving on to customizing the search results, you might want to make
small changes to the display of the Google search box and the elements sur-
rounding it. Doing so requires a bit of HTML familiarity, but some tricks are
downright easy. Remember the Terms of Service, summarized previously in
the chapter. You may not distort the Google logo, and you may not add dis-
paraging comments about Google. Beyond those innocuous guidelines, noth-
ing is stopping you from elongating or shortening the search box, stacking
the elements vertically instead of horizontally, changing the font type and
size, and forcing searches to appear in a new browser window.
Stretching and shrinking the search box
Google’s code automatically wraps the search button to below the search
form if your page doesn’t have enough room for the natural horizontal layout
shown in Figure 5-1. You can maintain the horizontal layout in a narrower
space by shrinking the search box. In the HTML code, look for this line:
<INPUT TYPE=text name=q size=25 maxlength=255 value=””>
The
size
variable determines the horizontal size of the keyword box; a smaller
number narrows the entry box. Figure 5-4 shows a keyword box at size 14.
Also in Figure 5-4, note that the elements are stacked vertically to fit into a
narrow table column. To create this stacking, you use the break tag,
br

.
Placed after a line of code, the break tag forces the next code element below
the previous one, instead of next to it. Here is what the modified code looks
like. The
br
tags are in boldface for emphasis:
<INPUT TYPE=text name=q size=25 maxlength=255 value=””><br>
<INPUT type=submit name=btnG VALUE=”Search”><br>
<A HREF=” /><IMG SRC=” />border=”0” ALT=”Google” align=”absmiddle”></A>
89
Chapter 5: Putting Google Search on Your Site
09_571435 ch05.qxd 5/21/04 11:30 PM Page 89

×