In 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 Piwik, click API, click on “UserCountry” then on the getLocationFromIp call.

Click to see typical response from the API.

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