How to Put Site Search on Your Website Using Google Custom Search Engine

A good practice for websites is to include a site search functionality on the site, so your visitors can locate the information they are looking for quickly. But how to set this up? And how can I keep the search results on my site so that the visitors don’t leave? In this post, I will discuss how to set up a site search using Google Custom Search Engine, with the result pages hosted on your own domain. The two key steps are 1) create your custom search engine, and 2) place the code in your website.

Create Custom Search Engine

First login to your Google account, then go to your Google Coop page. Click on the My Search Engines link under the Create your own search engine header, and click on the New Search Engine link. You’ll see the following screen.

Continue reading

Book Review: Adsense Code by Joel Comm

“Adsense Code” by Joel Comm was published in April 2006, and covered many topics related to Adsense. The book claims to reveal the “secret” of Adsense.

When I first read this book, I didn’t have any expectations. After all, I have been using Adsense since late 2003, and have pretty much seen all the techniques being discussed. However, I was in for a pleasant surprise: I actually found the book to be quite good. There are several reasons:

Continue reading

Adsense testing with PHP

One advice people always give for webmasters in the Google Adsense program is to test ad placement, color scheme, etc. A common test is the A/B test. There are several articles talking about how to set up such a test using either Javascript or PHP, and they invariably involve the use of a random number generator to determine whether a visitor would fall under the control group or the test group. Even Google’s official Adsense blog talks about it.

Continue reading

List of Official Google Blogs

Today Danny Sullivan posted an entry in SearchEngineWatch that lists all official Google blogs. Coincidentally, this is a piece of information I’ve been looking for myself. The links listed in that post were XML files, which are difficult to read for most of us. So, I am listing these sites in a more friendly format below:

AdWords API Blog
Blogger Buzz
Blogs of Note
Google AJAX Search API Blog
Google Analytics Blog
Google Code – Featured Projects
Google Code – Updates
Google CPG
Google Custom Search
Google Talkabout
Google Web Toolkit Blog
Google Webmaster Central Blog
Inside AdSense
Inside AdWords
Inside Google Book Search
Inside Google Desktop
Official Google Base Blog
Official Google Blog
Official Google Checkout Blog
Official Google Docs & Spreadsheets Blog
Official Google Enterprise Blog
Official Google Mac Blog
Official Google Maps API Blog
Official Google Reader Blog
Official Google Research Blog
Official Google Video Blog
The Writely Blog

Combo Search

Combo search refers to a different way of presenting search results. In the Google world, people are used to see pages after pages full of only web search results, or image search results, or new search results, etc (with the exception of some sponsored links). This is, however, not the way search results are presented in Korea.

Let’s take an example: search for “cat” in Naver, Korea’s top search engine. You’ll see a long results page divided into many different sections, including sponsored results, news results, category results, local results, book results, movie results, blog results, music results, knowledge results (similar to Yahoo Answers), as well as web results. This way, users are exposed many different types of results for that query term, and the user experience is entirely different.

This type of search results display is possible in Korea because of its high broadband penetration rate. With dialup access, this type of display would simply take too long to download.

This is perhaps why Google is not able to gain much in the Korea market. Google is noted for the simplicity of its pages, but this may work against them in Korea, where users have come to expect to see a large variety of pages.

In this type of system, SEO for web pages becomes less important because web results themselves are less important there. Even if you make it to #1 in web search, you might still be way below the fold (depending on where the search engine decides to place the web results section). In Korea, SEO thus means looking into image search, book search, etc, in addition to simply web search.

Convert IP Address to Country

One exercise that you’d like to do is find out which countries your visitors are coming from. There are several reasons for doing this:

1) You might want to tailor your content to that particular demographic.

2) If you have lots of visitors from a particular country, you might want to consider adding a version of your website in that particular language.

3) If your site has IP-based targeting for ads (programs such as Adsense have an IP-targeting component), this will help you understand why, or why not, your users are clicking on your ads.

The way I did it was to download a flat file that include IP-to-country mapping data from the link found here. This is a free database. There are other versions that claim to be more accurate, but they charge a fee. For my purposes, the free version is sufficient.

I first loaded this file into a database and then use a table join to lookup the country code from the IP number. This turned out to be a time-consuming exercise. Then, I remembered that in data warehousing, you want to do as much of your data transformation outside of the database as possible. Applying that principle, I moved the country lookup portion into the perl processing routine prior to loading the data into the database. This move proved to be an excellent time-saver.

Below I show the perl code for matching IP address with country code. There are 3 basic steps:

1. Read IP/Country mapping file.

2. Convert IP address to IP number.

3. Find country code based on IP number

The code for each step is shown below:

1. Read IP/country mapping file

open (IN1,’ip2country.txt’);
## ip2country.txt is the file that stores the
## IP number/country mapping data. Assuming the
## following format: IP_START,IP_END,COUNTRY_CODE.

$i=0;
while (<IN1>) {
chomp;
@ips = split (“,”);
$ip_start[$i] = $ips[0];
$ip_end[$i] = $ips[1];
$ip_country2[$i] = $ips[2];
$i++;
}

2. Convert IP address to IP number.

Assume IP address is already stored in the variable $ip_address

@ipp = split (/\./,$ip_address);
$ip_number = $ipp[0]*256*256*256+$ipp[1]*256*256+$ipp[2]*256+$ipp[3];

3. Find country code based on IP number

## We want to find the country code where $ip_number is between $ip_start and $ip_end.

while ($ip_number > $ip_end[$j]) {
$j++;
}
if ($ip_number > $ip_start[$j]) {
$country = $ip_country2[$j];
} else {
$country = ‘NA’;
}

Pimp My Blog in 8 Steps – Steps 7 & 8: Header Tags and Enable Auto Discovery

This post talks about the final two steps in pimping my blog.

7. Change template for header tags

You’ll want to make sure the most important elements of your blog, such as your blog title, are in the <h1> tag. Other elements, such as the date of your posting, should be de-emphasized and not be in <h1> or <h2>. For example, in the Blogger template I chose, the default tag for the blog title was <h3>, while the default tag for the date of the blog was <h2>. That was changed to make sure search engines see what’s really important.

8. Enable auto discovery

Auto discovery enables your readers one-click subscription to your blog. If your readers have an auto discovery-enabled browser such as Firefox, or use a RSS reader, they’ll see a feed icon feed icon when they visit your blog. They can then subscribe to your block by simply clicking on the feed icon.

This step simply requires adding a line of code into the template:

<link rel=”alternate” type=”application/rss+xml” title=”[your blog’s title]” href=”[your blog’s feed URL]” />

For my case, it’s <link rel=”alternate” type=”application/rss+xml” title=”TopCat Blog” href=”http://feeds.feedburner.com/TopCatBlog” mce_href=”http://feeds.feedburner.com/TopCatBlog” />.

You will want to add this line between the <head> … </head> tags. In Blogger, make sure this is above the <$BlogMetaDate$> line.

Summary

You are set! Now you should have all the ammunication you need to reach out. Just monitor your audience via Feedburner, Technorati, or your own web analytics, and keep blogging.