@robocoder opened this Issue on January 16th 2010 Contributor


The ActiveIP2Country plugin uses an IP-to-country database to determine the visitor's country. In contrast, Piwik normally guesses the visitor's country from his/her browser language and region.

Note: due to changes in IP block assignments, ActiveIP2Country does not attempt to correct earlier log_visit data.

This plugin uses any CSV (comma-separated values) file (named "ip-to-country.csv") containing IP address ranges (start and end expressed as longs) followed by a two letter ISO country code. Values may be double quoted. The country code can be upper or lower case.

The plugin will automatically generate a more compact, binary "ip-to-country.dat" file. To regenerate this file, simply remove it.


On my antiquated Athlon 1.4 GHz processor (test box):

  • search overhead adds ~ 2 ms per query

If shared memory is available:

  • minimum shared memory segment requires approx: 1 MB
  • loading .dat file into memory: ~ 1 ms

If updating the .csv file:

  • time to re-generate .dat file: ~ 7s


  • Piwik 0.5.5 (or above)

    To install

  • Extract the attached .zip file in the plugins folder.
  • Activate the plugin from the Settings | Plugins tab.

    For support

  • Send me a tweet @vipsoft
@robocoder commented on January 16th 2010 Contributor
@robocoder commented on January 16th 2010 Contributor

Attachment: 2010.01.12 update of ip-to-country.csv

@robocoder commented on January 16th 2010 Contributor

Updates to the .csv file can be found at:

@robocoder commented on September 9th 2010 Contributor


  • merge functionality from #45 into this plugin but re-use the existing country & continent columns, with fallback to region from browser language
  • add an installation/settings screen that (1) tests the server capability (e.g., mod_geoip or geoip extension installed, ability to use GEOIP_MEMORY_CACHE, etc; (2) button to run the geoipupdaterows script; (3) allows the user to select which geolocation implementation to use
  • refactor so that other implementations are available, e.g.,

(This isn't being suggested for #45 due to trademark issues.)

@mattab commented on April 23rd 2011 Member

I assume we can close this ticket, once GeoIP is in core? #1823

@robocoder commented on April 23rd 2011 Contributor

Yes, I'm rolling it into the new plugin.

@robocoder commented on April 29th 2011 Contributor

Actually, I'll close this ticket now as the ip-to-country.csv file is longer being maintained. (4 months without an update)

This Issue was closed on April 29th 2011
Powered by GitHub Issue Mirror