Note: This guide is applicable only for Matomo On-Premise, if you have any issue with Geolocation in Matomo Cloud, please get in touch with our Support team.

Geolocation is the process of determining where an IP address is geographically located. Matomo offers various methods to determine your visitors’ location:

  • Before 1.9, Matomo (Piwik) guessed a visitor’s location based on the language they used.
  • In 1.9 and later, Matomo included the ability to use one of MaxMind’s GeoIP (Legacy) databases to more accurately determine the locations of visitor IPs.
  • We recommend using DB-IP’s geolocation databases, though currently the city level results are not very accurate. You can alternatively use MaxMind’s GeoIP2 databases but you will have to sign up for an account, even for the free databases.

There are also some plugins on the Marketplace that give the ability to use other Geolocation providers, such as IP2Location.

Enabling Accurate Visitors Geolocation in Matomo Analytics

To enable GeoIP2 go to the Administration > 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 GeoIP2 database. The easiest way to start using GeoIP2 is to use the ‘GeoIP2 (Php)’ option. All that is required to use this option is to install a GeoIP2 database.

The other options are faster, but are more complicated to setup. In addition to installing a GeoIP2 database, you have to install other software. You can see instructions for installing these options in the resources section below.

Once a GeoIP2 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.

Reports: Continent, Country, Region, City & Provider

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 GeoIP2 geolocation option was used when tracking the visits during the period. Otherwise, they will have one “Unknown” row:

Maintaining Geolocation Databases

The data used to find locations for IP addresses changes constantly, either due to IP addresses changing owners or due to database providers applying corrections. You can setup Matomo to automatically download the latest version of a database in the “Setup automatic updates of GeoIP databases” section of Administration > Geolocation.

DB-IP updates their free databases once a month, and their commercial databases every day. Matomo can be set to auto update the geo databases every week or every month. The geolocation databases automatic updates are executed by the Matomo Archiving script.

Details & Resources

When is a Visitor detected as Unknown city or country?

If you are using GeoIP2 it is possible you will still see many of your visits as located in an “Unknown” region or city. This is unfortunate, and DB-IP 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 purchase the commercial databases.

Exactly how accurate is accurate?

The GeoIP2 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.

You can read about the accuracy of DB-IP’s databases here. (Note: currently DB-IP’s city geolocation results do not appear to be very accurate.)

What about World Maps and Region maps?

Matomo comes with beautiful world map, but also detailed per-country region and cities maps! Learn more about our Visitor Maps, and also the Real Time Visitor Maps!

Geolocation and Privacy

A couple notes about Geolocation and Privacy in Matomo:

  • The geo location database is installed in your server, so your visitor IP addresses (and any other of your data) will never be sent to an external geo location server.
  • If you enable IP anonymisation (which is the default in Matomo), then by default Matomo will not store the full IP address in the database, but it will still use the full IP address to get the geo-location information (for better accuracy). For better privacy, you may change this setting in Matomo Settings > Privacy > Anonymize data, and under “Anonymize Tracking Data” set the setting “Also use the Anonymized IP addresses when enriching visits.” to “Yes (recommended for privacy)”.

Advanced reporting

Do you not get the insights you need out of the standard reports in Matomo? You can create any report tailored to your needs using the Custom Reports premium feature in a matter of seconds. For example, easily see which pages were viewed how often per region or country. Or see which referrers work best per region or country. The sky is the limit.