How do I get the DB-IP databases or Maxmind GeoIp2 to improve accuracy of Country detection, and detect visitors’ Cities and Regions?
Matomo recommends the use of
1. DB-IP‘s databases,
2. or if you are willing to sign up for a MaxMind account: the MaxMind GeoIp2 databases which are currently more accurate at the city level.
These databases are sold either by DB-IP (DB-IP sells different databases, each with different amounts and types of information) or MaxMind.
The country and city databases can be used to determine the location of an IP address with different amounts granularity:
- The country database can only tell you the country of an IP address.
- And, the city database can tell you the country, region, city, postal code, geographic coordinates (latitude/longitude) and area code of an IP address.
The ISP and Organization database can be used to determine the ISP and company of an IP address.
You can find more information on the commercial DB-IP databases here.
Both providers provide two free databases that are less accurate than the commercial ones. One of the free databases can only be used to determine an IP address’ country. The other, the IP to City Lite, can be used to determine the same information as the commercial city database.
You can find more information on the free Lite databases here.
Needless to say, we recommend using one of the city databases.
Matomo includes a tool that will download the IP to City Lite database for you. You can access the tool by navigating to Settings > Geolocation.
If you want to install the database by hand, you can download each of the free databases here. Make sure to download the binary versions of the databases.
Keep in mind that geolocation data will eventually become out of date. It is recommended you update your databases at least once a month.* The free databases are updated once a month.
Note: The latest version of Matomo includes an auto-updater for these databases.
If you are installing the databases manually, then once you get the database you want to use copy it (the .mmdb file) to Matomo’s path/to/matomo/misc/ subdirectory. All common file names should already be supported. (You can find the list of supported file names here)