If you want to know the location of the visits your website received before you started using Piwik with GeoIP, we’ve prepared a script that will help you. This script will geolocate every one of your visits that have not been located. Since it goes through every visit in your database, it will take a very long time to run.

The script is called geoipUpdateRows.php and is located in the misc/others subdirectory of your Piwik installation. You don’t need to do anything special to run it, just cd into the directory and run:

php ./geoipUpdateRows.php

Things you should note:

  • This script only works with the GeoIP PECL extension or the GeoIP PHP API.
  • If you use the GeoIP PHP API it will take even longer to run, so we recommend using this script with the GeoIP PECL extension. You can see how to install the PECL extension here.

After you run the script make sure you reprocess your reports so new reports w/ location data will be shown.