HB Blogside

Search engine position checking

Robert Wallace Technical Director
Robert Wallace Technical Director

One of the tasks you often want to do is to check which page your site shows on for a particular search engine with a particular query.  If you do this entirely by hand it becomes quite tedious. You go to Google, or Bing, or Yahoo and type in your search term. Then on the search page you have to scroll through the page looking for your site. And if you don’t find it you click the “next” link and repeat.

Well you can automate it by using a bookmarklet. As I have mentioned in other posts I am a big fan of bookmarklets. (A bookmarklet is basically a piece of JavaScript code that is embedded in a web address (URL) and saved as a bookmark or, in Internet Explorer (IE), a favorite.)

Below is some JavaScript code that I use in a bookmarklet that lets me quickly page through a set of search engine results until I find my site (http:hbdesign.com).

if (window.find("HB Design"))
{
    window.scrollTo(0, document.body.scrollHeight);
    alert("found");
}
else
{
   window.scrollTo(0, document.body.scrollHeight);
   if (location.href.match(/bing/))
   {
       document.getElementsByClassName("sb_pagN")[0].click();
   }
   else if (location.href.match(/yahoo/))
   {
       document.getElementsByClassName("next")[0].click();
   }  
   else if (location.href.match(/google/))
   {
       document.getElementById("pnnext").click();
   }
}

You can copy and paste this code into an on-line bookmarklet generator to create the bookmarklet. I used http://mrcoles.com/bookmarklet/. Before you do, change the first line (where it says “HB Design”) to what your site name is, as it shows in the search results.

Once you create the bookmarklet all you need to do is perform a search in either Google, Bing, or Yahoo. Then click on the bookmarklet. If your site is on the page the bookmarklet will show an alert. If not, it will automatically load the next page. Just keep clicking the bookmarklet after each page is loaded until you find your site.

To quote The Hitchhiker’s Guide to the Galaxy, “Share and Enjoy.”

This entry was posted in Technology and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.




eighteen − 4 =