In Matomo (Piwik) we recommend to configure Geo Location so that your visitors are accurately tracked. Once it is setup, you can use the GeoIP database to get an IP to Country, or IP to City, or IP to Region information. We have added a simple API that you can re-use, called UserCountry.getLocationFromIP.

To use it, go to Matomo, click API, click on “UserCountry” then on the getLocationFromIp call.

Click to see a typical response from the UserCountry.getLocationFromIP API call.

You may use this simple Web API provided by Matomo to add geo location functionality to your Apps, for example.