sam's bits

ramblings on technology and other stuff

IP geolocation with city-level accuracy in Piwik Web Analytics

Piwik city-level location

Piwik Web Analytics is a self hosted PHP application that does exactly the same thing as Google Analytics: It tracks users that come to your websites, how often, where from, etc..

By default Piwik can recognise which country the user is from. If you want to have more precise location information, like the city you have to add an IP geolocation database.

  1. Download and decompress the MaxMind City Geolite database
  2. Upload it to the /misc directory in your Piwik root directory.
  3. Login to your Piwik instance and browse to “Settings”, then “Geolocation”
  4. Select “GeoIP (PHP)” and save your settings

Future visitors to your website will now be logged with an approximate (~40km radius ~60% of the time) city location.

Categories: Web Development

Tags: analytics, piwik, geoip

Comments: No comments yet

Post a comment