Visitor Country

A plugin that retrieves the visitor's country information (using MaxMind's GeoIP local dat file)

Author:Izhaki (profile at wordpress.org)
WordPress version required:3.2
WordPress version tested:3.5.1
Plugin version:1.1
Added to WordPress repository:20-03-2012
Last updated:27-05-2013
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:3
Plugin URI:http://gefri.org/misc/wordpress/visitor-count...
Total downloads:4 932
plugin download
Click to start download

This plugin adds support for displaying (using shortcodes) or enquiring (using PHP or JS) the visitor's country. See it working here.

It uses MaxMind's GeoIP data file, which is around 1.4 MB in size and is included with the plugin. The file is free, updated every month, and has the claimed accuracy of 99.5%;

GitHub Repository is here.

The plugin retrieves:

  • The visitor's IP
  • The visitor's country name
  • The visitor's country code (2 letter ISO 3166)

The shortcodes are:

  • [VisitorCountry-IP]
  • [VisitorCountry-Code]
  • [VisitorCountry-Name]

The javascript variables are:

  • VisitorCountry.ip
  • VisitorCountry.code
  • VisitorCountry.name

And the PHP functions:

global $VisitorCountry;
if ( isset($VisitorCountry) )
{
    echo $VisitorCountry->GetIP();    
    echo $VisitorCountry->GetCode();
    echo $VisitorCountry->GetName();        
}

Please leave suggestions, comments and bug report at the plugin's website.

Also, please let it be known if the plugin works on versions older than 3.2 - I simply didn't have a way to check.

This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/app/geolitecountry