Geolocation is the process of determining where an IP address is geographically located. Piwik provides two methods to determine your visitors’ location:
To enable GeoIP go to the Settings > Geolocation admin page. Here you will see the list of options available for determining a visitor’s location:
The Default option uses the pre-1.9 method of geolocation. That is, it will guess based on a visitor’s language.
The other options are different ways of using a GeoIP database. The easiest way to start using GeoIP is to use the ‘GeoIP (Php)’ option. All that is required to use this option is to install a GeoIP database.
The other options are faster, but are more complicated to setup. In addition to installing a GeoIP database, you have to install other software. You can see instructions for installing these options in the resources section below.
Once a GeoIP option is installed, it should be selectable and be Installed.
If there’s something wrong with the setup, it will be Broken, and the reason why will be displayed.
To use an option, simply select it.
The geolocation feature provides the data for all of the reports on the Visitors > Locations & Provider page. On this page you can see what geographic locations most of your visits come from.
The Region & City reports will only be populated if a GeoIP geolocation option was used when tracking the visits during the period. Otherwise, they will have one “Unknown” row:
The data used to find locations for IP addresses changes constantly, either due to IP addresses changing owners or due to MaxMind applying corrections. You can setup Piwik to automatically download the latest Maxmind databases in the “Setup automatic updates of GeoIP databases” section of Settings> Geolocation.
MaxMind updates their free databases once a month on the first Tuesday, and their commercial databases every week on Tuesday. Piwik can be set to auto update the geo databases every week or every month. The geolocation databases automatic updates are executed by the Piwik Archiving script.
When is a Visitor detected as Unknown city or country?
If you are using GeoIP it is possible you will still see many of your visits as located in an “Unknown” region or city. This is unfortunate, and MaxMind does its best to provide accurate and complete data, but geolocation will never be 100% accurate.
Also, if you’re using the free database, your results won’t be as complete and accurate as the commercial ones. If you feel this additional accuracy would be helpful to you and/or your business, you can buy the commercial databases here.
Exactly how accurate is accurate?
The GeoIP databases aren’t 100% accurate, and the accuracy depends on what type of location information you’re interested in, and it varies by country as well.
MaxMind’s databases are 99.8% accurate at the country level (99.5% for the GeoLite City database) and 90% accurate at the region level (there is no listed accuracy for the GeoLite City database). The city level accuracy depends on the country. You can find more information on the commercial database accuracy here and on the GeoLite City database here.
What about World Maps and Region maps?