Martic.net

Talking in binary since 1980.

You should know how to welcome your visitors !

Darko at 11:17 pm on Tuesday, August 14, 2007

willkommen.jpgVisitors will like your web site if you make a nice welcome for them. Knowing where are they coming from can help you attract new visitors and also keep the visitors come back.
Of course, the most important thing is to have a quality content, but if you don’t serve it right - visitor might miss the content…

Imagine this as if you were the visitor:

  • you opened a web site and it’s default language is your native language
  • opening a registration form, your country is automatically selected
  • content is served with priority to content related to my country of residence

Doesn’t this sounds cool?
Well, you can do the same for you own web site…

The service we’ll be talking about are - GEO IP services. They work in the way of “reading” the IP address of a visitor and searching it in a large database of world-wide IP addresses with geographic informations (this is just a simplified description).

There are number of companies that provide GEO IP service, for example the MaxMind.com is one of the most popular. They, as many others, offers you to download IP address database and use it in your own application from which you’re performing an IP search. There are free and paid versions of this database to download. The paid one is of course - more accurate one.

There is one service that is completely free, I wouldn’t compare it’s accuracy with the paid versions but I like it cause it’s very easy to use.
You can find it here: HostIP.info

When programming, all I need to know about visitor is his locale (en, de, etc.). When I know this, I can control all those things I wrote at the begining of this post (default language, default country selected in a drop down, etc.).

To fetch a locale, I use the following code (this is just an example):

  1. <?php
  2. if(empty($_SESSION[‘language’])) {
  3.    $visitorIP = $_SERVER[‘REMOTE_ADDR’];
  4.    $locale = @file("http://api.hostip.info/country.php?ip=".$visitorIP);
  5.    switch($locale[0]) {
  6.       case ‘HR’:
  7.          $_SESSION[‘language’] = "hr";
  8.         break;
  9.       case ‘DE’:
  10.          $_SESSION[‘language’] = "de";
  11.         break;
  12.       case ‘AT’:
  13.          $_SESSION[‘language’] = "de";
  14.         break;
  15.       default:
  16.          $_SESSION[‘language’] = "en";
  17.         break;
  18.    }
  19. }
  20. ?>

And that’s it. With this code, I have a session variable with the locale information, now I can do everything…
 

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Enter this code

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
 
Close
E-mail It
Socialized through Gregarious 42