In 2002, Google implemented an API for its popular search engine to allow web developers to perform Google searches on their own web sites. Using SOAP (Simple Object Access Protocol), the API allows the search and results retrieval to run in the background. Many people also like to make use of the Google API in order to customise the way search results are displayed on their sites. However, one of the lesser-known benefits of being able to access the Google API is that you can use it to find your site's search ranking in Google, without having to visit the Google web site.
Developers and site owners are often interested in keeping up to date with how well their sites rank for certain keywords. The traditional way to do this is to type your search term into google.com (or your browser's Google search bar), then manually sift through the result pages that appear, looking for your URL. If your site is not optimized for the keyword that you searched for, your URL may be ranked quite low (for example, on the 50th page!). In situations like this, looking for your URL would be tedious, to say the least.
Fortunately, web services are available that automate this otherwise time-consuming process. However, many of these services place restrictions on the number of records you can query. For example, some web services will stop looking for your URL after the 200th record.
In this article, I'll introduce a script that enables you to utilize the Google API to find your site's ranking in Google. The script has a built-in feature that queries the Google server again if there is an error, and allows you to limit the number of results that are returned. I've packaged up this script so you can
download the code we'll use in this article.
Note that at the time of writing, the Google API was still in beta. As a result, there might be some changes to the Google API in the future, though I don't imagine that they'd be too drastic.
For those of who aren't interested in delving through code, feel free to
check out a little demo I made to see what I'm on about (you'll need to sign up for a
http://www.google.com/apis Google API key, though).
Requirements
Google Key