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’;
}

Summary: Firefox extensions for SEO

After reviewing the 5 Firefox extensions for SEO, we find that there are basically two different categories of extensions: 1) one that adds SEO-related information to search results, and 2) one that shows SEO metrics for the page you are currently on. Extensions built by SEO Book and SEO Quake fall under the first category, and extensions built by Rank Quest, SearchStatus, and SEOpen fall under the second category.

Because the two categories of extensions are very different (first category is for people doing serious SEO research, second one is for people who are interested in the site they are looking at), I decided I will recommend one extension from each category:

Category 1: Adding SEO-related information to search results

I think both tools are excellent, as evident from both getting a total score of 25. SEO Book’s information on query terms is countered by SEO Quake’s ability to show information on the page you are visiting. At the end, the difference was that I just did not like SEO Quake’s display under the sponsored search section in the search results pages. Therefore, I will go with SEO Book’s tool.

Category 2: Showing SEO metrics for the pages you are currently on

For this category, the winner is SearchStatus. The fact that it shows the information at the status bar at the bottom of Firefox rather than eating up real estate by showing a toolbar is the differentiating factor.

Summary

I recommend that people use the extension from SEO Book for serious SEO research, and the extension from SearchStatus for getting SEO information for a particular site.

SEOpen Firefox Extension

Today let’s take a look at the SEOpen Firefox extension. This extension can be downloaded from https://addons.mozilla.org/firefox/570/. This extension adds a toolbar on Firefox, from where you can view SEO-related information from Google, Yahoo!, MSN, Alexa, and several other resources on the page you are at.

Below is a screenshot of what the extension looks like when clicking on “Other Tools”.

seopen

Below is the score for each category:

Ease of installation: 5
Ease of use: 3
Amount of time for the information to appear: 4
Usefulness of information presented: 3
Amount of real estate taken up: 3
Documentation: 3
Total: 21

Ease of installation: Installation was quick and problem free.

Ease of use: There was a problem with one of the links (page size, which returned a 404).

Amount of time for the information to appear: It takes two clicks to get to the desired information. Once the metrics are selected, though, information does appear quickly.

Usefulness of information presented: Good for getting info on the page you are on. A minus is that it shows backlinks info from Google, and it is known that the link: command in Google returns incorrect numbers.

Amount of real estate taken up: An additional toolbar appears on the browser.

Documentation: Adequate documentation is available at http://seopen.com/firefox-extension/index.php.

Wish List

Make sure all links are valid.

Take out information that is known to be highly inaccurate (such as backlinks from Google).

SearchStatus Firefox Extensions

Today let’s take a look at the SearchStatus Firefox extension. This extension can be downloaded from https://addons.mozilla.org/firefox/321/. This extension adds toolbar information on the status bar at the bottom of Firefox by default. PR and Alexa are displayed directly. Additional SEO-related data can be viewed by right clicking on the q sign (logo).

Below is a screenshot of what the extension looks like when right-clicking on the logo:

searchstatus

Below is the score for each category:

Ease of installation: 5
Ease of use: 4
Amount of time for the information to appear: 4
Usefulness of information presented: 3
Amount of real estate taken up: 5
Documentation: 3
Total: 24

Ease of installation: Installation was quick and problem free.

Ease of use: Easy to use. PR and Alex ranking are shown directly. Additional information can be retrieved by right clicking on the SearchStatus logo. It does take a little bit of navigation to get to the information you want.

Amount of time for the information to appear: It takes several clicks to get to the desired information. Once the metrics are selected, though, information does appear quickly.

Usefulness of information presented: Good for getting info on the page you are on.

Amount of real estate taken up: Users can customize where the information from this extension shows up. The default is the status bar, which doesn’t occupy any additional real estate.

Documentation: Adequate documentation is available at http://www.quirk.biz/searchstatus/.

Wish List

Change the menu system so that fewer clicks are needed to get to the information needed.

RankQuest Firefox Extension

I have also tried the RankQuest Firefox extension. This extension can be downloaded from https://addons.mozilla.org/firefox/1471/. This extension adds a toolbar to Firefox. The toolbar contains links to many SEO-related functionalities, including the information on query terms and specific sites.

Below is a screenshot of what the extension looks like:

rankquest

Below is the score for each category:

Ease of installation: 5
Ease of use: 2
Amount of time for the information to appear: 5
Usefulness of information presented: 4
Amount of real estate taken up: 3
Documentation: 3
Total: 22

Ease of installation: Installation was quick and problem free.

Ease of use: Clicking on the toolbar takes you to a new tab. After checking several sites / query terms, the number of tabs can become unmanageable.

Amount of time for the information to appear: Data loads quickly.

Usefulness of information presented: Good information on the specific sites / query terms requested. There are also links to general SEO help. I don’t believe this is a useful feature for any SEO serious enough to install a toolbar.

Amount of real estate taken up: An additional toolbar is shown.

Documentation: Adequate documentation is available at http://www.rankquest.com/toolbarhelp.html.

Wish List

Ability to provide the option within the tool to specify whether to open a new tab or use the current tab.

Firefox Extension from SEO Quake

The second Firefox extension I tried was SEO Quake’s tool. This tool can be installed from Firefox’s extensions page at https://addons.mozilla.org/firefox/3036/. By the way, previously I had been using the term “plugin”, but it appears that “extension” is the proper term, so I’ll use “extension” from now on.

The highlights for this extension include:

1. Works on Yahoo, Google, MSN, and Russian search engines Rambler and Yandex by supplementing search results with key SEO statistics for each result.

2. For other web sites, a SEO Quake toolbar appears just above the page to indicate key SEO statistics for that page.

Below is the screenshot of how the extension looks on a Google search results page:

seoquake

1: Extra space taken up by SEO Quake, quite possibly for its own sponsored search results later.
2: Information related to each term.
3: The SQ symbol on the status bar means the SEOQuake extension tool has been installed.

Below is the screenshot of how the extension looks on a non-search results page:

seoquake

4: A toolbar showing SEO statistics for the site you are viewing.

Below is the score for each category:

Ease of installation: 5
Ease of use: 4
Amount of time for the information to appear: 5
Usefulness of information presented: 4
Amount of real estate taken up: 4
Documentation: 3
Total: 25

Ease of installation: Installation was quick and problem free.

Ease of use: It’s about at the same level as the SEO Book extension.

Amount of time for the information to appear: Data loads quickly.

Usefulness of information presented: The only thing missing is query-level information for web searches.

Amount of real estate taken up: On search results pages, only the metrics user specified show up. This avoided wasting valuable space. The toolbar showing site-specific SEO data took up a bit more space than I’d like to see.

Documentation: Adequate documentation is available at http://www.seoquake.com/index-en.php.

Wish List

1. I did not like the fact that the SEO Quake message appears in the sponsored search listings area.

2. Better documentation. It took me a bit of time to find out Yandex and Rambler are both Russian search engines.

Firefox SEO Plugin from SEO Book

Over the next several days, I will review the Firefox plugins available for the SEO community. The first is the SEO plugin produced by Aaron Wall of SEO Book. The plugin is not available at the Firefox extensions section, but can be accessed at the SEO Book site.

The highlights for this plugin are:

1. Requires no additional real estate on the toolbar. The presence of the plugin is indicated on the right side of the status bar.

2. Works on Google and Yahoo search results pages (not on other pages); displays information related to the query term and sites on the web page itself.Below is a screenshot of how the tool looks like when I search on Google:

seobook

1: Information related to the query term.
2: Information related to each site.
3: The SEO symbol on the status bar means the SEO plugin tool has been installed.

Below is the score for each category:

Ease of installation: 5
Ease of use: 4
Amount of time for the information to appear: 3
Usefulness of information presented: 5
Amount of real estate taken up: 3
Documentation: 5
Total: 25

Ease of installation: Go to the site, click on the link to start the install, and restart Firefox. Very easy and straightforward.

Ease of use: I was slightly confused at the very beginning as to how best to leverage the tool. However, everything became clear after a little reading and playing with the tool.

Amount of time for the information to appear: It does take a bit of time for all relevant data to show up for each link.

Usefulness of information presented: Information shown is very useful, covering both the site and the query term.

Amount of real estate taken up: Due to amount of information shown, this tool does take up a fair amount of real estate on the web page.

Documentation: A good documentation is available at the download site.

Wish List

1. I hope the extension only lists the information the users wish to see. For example, as the figure shows, I only want to see 3 data points for each link, yet all data points were listed, occupying valuable real estate unnecessarily.

2. Right now, the way the information is updated for links is that one set of data points is populated first, and then the next set. For example, PR info for all sites are updated before Age info. It would be great if information can be updated by link — i.e., all data points for the first result are shown before any data point for the second result is shown, and so on. I tend to want to see all information for a single site at once, and naturally I’ll be looking at the results for the top-ranked sites first. Currently I have to wait a while before I can see the complete result for any site.

3. Inclusion of additional search engines, such as MSN and Ask.com.