How to resolve common Location Detection Errors in Matomo
Matomo determines visitor locations using IP-based geolocation. When a visitor accesses your website, Matomo captures the IP address (based on the configured privacy settings) and matches it against a geolocation database to estimate their country, region, and city.
- Matomo Cloud uses a geolocation database with automatic updates. No manual setup is required for geolocation to work.
- Matomo On-Premise requires manual installation of a geolocation database (e.g., GeoIP2 or DB-IP), which should be regularly updated.
While Matomo uses IP-based geolocation to estimate visitor locations, various factors can impact accuracy or prevent location detection altogether. Privacy settings, network configurations, and database issues can all contribute to incorrect or missing location data.
This guide applies to Matomo On-Premise only. The following section lists common causes of location detection errors with troubleshooting steps to resolve them.
If you experience geolocation issues in Matomo Cloud, contact our Support team.
Geolocation Databases
Matomo determines visitor locations using GeoIP2 or DB-IP databases. If these databases are missing, outdated, or misconfigured, location tracking may be inaccurate or unavailable. If no geolocation method works, Matomo logs the visitor’s location as “Unknown.”
Additionally, free databases offer basic accuracy, but commercial databases (e.g., MaxMind’s GeoIP) provide more precise location data, especially for cities and ISPs.
Recommended steps
- Check your geolocation method in Matomo settings
> System > Geolocation. If the incorrect method is selected or misconfigured, Matomo may attempt to use PHP’s built-in GeoIP functions, which provide limited accuracy.
- Read more about Setting Up Accurate Visitor Geolocation.
- Explore Matomo’s recommended geolocation databases – How do I get the DB-IP databases or Maxmind GeoIp2.
Matomo is behind a Reverse Proxy or CDN
If Matomo is hosted behind a reverse proxy or CDN (e.g., Cloudflare, AWS, Nginx, Apache Proxy) and is not properly configured to extract the real client IP, it may log the proxy’s IP address instead of the visitor’s actual IP. This can result in inaccurate location detection and incorrect analytics data.
Additionally, when users connect via VPNs, mobile networks, or personal proxies, their actual location may not be accurately detected due to masked or dynamically assigned IPs. While this is a limitation of IP-based geolocation, ensuring Matomo correctly handles IP forwarding can help improve accuracy.
Recommended steps
- Before making changes, check whether Matomo is recording the correct visitor IP. Compare the IP Matomo detects with an external IP lookup service (e.g., WhatIsMyIP).
- Reverse proxies and CDNs typically forward the real client IP in HTTP headers (e.g.,
HTTP_X_FORWARDED_FOR
,HTTP_CLIENT_IP
). Matomo must be configured to use the appropriate forwarded IP header to extract the correct visitor IP. - Read more on how to configure Matomo when the server is installed behind a proxy.
Browser Geolocation
Matomo does not natively support browser-based geolocation (which relies on the Geolocation API to request precise location data from the user’s device). Instead, Matomo determines visitor locations using IP-based geolocation, which depends on the installed GeoIP2 or DB-IP database.
If Matomo has been customised to use browser-based geolocation, location accuracy will depend on browser settings, user permissions, and network conditions.
Some privacy-focused browsers or settings, such as Incognito/Private Browsing Mode, may prevent websites from storing or requesting geolocation data. However, Matomo does not automatically request geolocation from the browser, so blocking or allowing location access in browser settings does not affect Matomo’s default geolocation tracking.
If location data is missing or inaccurate, the issue is more likely related to IP-based geolocation settings.
Recommended steps
- Check your geolocation method in Matomo settings
> System > Geolocation.
- Read more about Setting Up Accurate Visitor Geolocation.
IP Anonymisation Settings
Matomo provides IP anonymisation settings to protect user privacy by masking part or all of a visitor’s IP address. This helps ensure compliance with privacy regulations such as GDPR and ePrivacy, but it also reduces geolocation accuracy. The more an IP is anonymised, the less precise the location data will be.
Recommended steps
- Navigate to Privacy > Anonymise Data > Anonymise Visitors’ IP Addresses and check whether partial or full anonymisation is enabled, as this directly impacts geolocation precision.
- If more accurate location tracking is required, consider adjusting anonymisation settings while remaining compliant with privacy laws. Balance user privacy with geolocation accuracy based on your legal requirements and data policies.
- Read more about how IP Address anonymisation works in Matomo.
- Learn how to Configure Privacy Settings in Matomo.
Matomo Logs show invalid/missing IP Addresses
If location data is consistently incorrect for all visitors, or if IP-based geolocation is failing entirely, Matomo’s server logs may provide insight into the issue. Logs can help identify IP detection failures, geolocation database errors, or incorrect server configurations that may be preventing Matomo from capturing visitor IPs accurately.
Recommended steps
- Check Matomo’s server logs for errors related to GeoIP lookup failures or missing geolocation databases. Errors may indicate that Matomo is unable to retrieve IP-based location data due to configuration or database issues.
- If Matomo is behind a reverse proxy or CDN, logs may show proxy IPs instead of real visitor IPs if headers are not configured correctly.
- When full IP anonymisation is enabled, logs may show masked IPs (e.g., 0.0.0.0), which prevents accurate geolocation. Ensure that Matomo’s data privacy settings align with the expected level of IP masking.
- Where Matomo cannot access the configured GeoIP2 or DB-IP database, it may log “Unknown” locations.
- Check that the geolocation database is installed and regularly updated.
- Read more about why the same IP appears for all visitors.
If logs confirm that Matomo is not receiving the correct IP information, review server, proxy, and Matomo settings to identify any misconfiguration.