«« Hehehe «« [ Main ] [ En Francais ] »» Squirrel »»

November 14, 2004

awstats and MyWorld66

MyWorld66 is a website that you can use to generate maps, including a "visited country" map: http://www.world66.com/myworld66/visitedCountries. Pick a few countries in the list, and click on Generate Map. It generates a nice world map where selected countries are highlighted. It also gives you the html code you can insert in you own web page.

For instance, if you pick Canada, USA, France, United Kingdom and Belgium you get the following HTML code:

<img src="http://www.world66.com/myworld66/visitedCountries/worldmap?
visited=CAUSBEFRUK"><br/> <a href="http://www.world66.com/myworld66">create your own visited country map</a>
or check our <a href="http://www.world66.com/europe/netherlands/amsterdam">Amsterdam travel guide</a>

You probably noticed that the last part of the image source url consists of a list of the country codes in the same format as the one used for domain names (ca Canada, us USA, be Belgium, etc...)
I wanted to have such a map that would would highlight the location of people visiting this web site but I did not want to go to the myworld66 site and select the countries found on my site logs which can be tedious...
Besides, I am using awstats for my stats (here) and there is an awstats page that show the country list of your monthly visitors in an html table, one of the column is the 2-digit country code in domain name format. This is mine: http://www.windal.net/cgi-bin/awstats.pl?config=www.windal.net&output=alldomains

Anyway, I made a small CGI that extracts the list of countries from the awstats html page and builds the myworld66 page automatically. My perl skills are very limited, there is probably a smarter way to do that but it works! The script is here.

And here you go for the final result, the map of November visitors (so far) generated automatically with the CGI above:


create your own visited country map or check our Amsterdam travel guide

Posted by sebatl at November 14, 2004 11:37 AM
Comments