Ticket #45 (reopened New feature)

Opened 6 months ago

Last modified 4 days ago

Plugin for a precise geo localization

Reported by: matt Assigned to:
Priority: major Milestone: Future features
Component: Plugins Version:
Keywords: Cc:

Description

This feature is requested by the community (http://feedback.phpmyvisites.net/feedbacks/2628-precise-country-geo-localisation)

  • Precise Geo-localization
    • detects precise country / cities of visitors using GeoIP database
    • display table of cities
    • modify the existing country table in the interface (provided by the plugin UserCountry) so that a click on a country displays the cities in this country
    • modify the last visitor report plugin (see #44) and add a column for the city

Attachments

GeoIP_0.1.zip (17.3 kB) - added by mikael on 04/09/08 04:57:55.
GeoIP_0.2.zip (17.4 kB) - added by mikael on 04/13/08 07:35:50.
GeoIP_0.3.zip (183.3 kB) - added by mikael on 07/01/08 03:45:13.

Change History

01/04/08 01:54:06 changed by matt

  • milestone set to Future features.

01/13/08 18:11:33 changed by matt

  • type changed from Bug to New feature.

01/15/08 02:57:07 changed by Eli-D

MaxMind has a popular geo location database and related tools. Listed in order of performance, pure php being the worst.

Pure php code: http://www.maxmind.com/download/geoip/api/php/

A php extension in PECL: http://pecl.php.net/package/geoip

An apache plugin: http://www.maxmind.com/app/mod_geoip

03/12/08 01:57:21 changed by mikael

I am precisely working out it (actually almost over).

04/09/08 04:57:55 changed by mikael

  • attachment GeoIP_0.1.zip added.

04/09/08 04:59:26 changed by mikael

  • status changed from new to closed.
  • resolution set to fixed.

Here we go!

The version 0.1 of the GeoIP localisation plugin has been released.

Features

  • Register the location of your users: Continent, Country, City, Latitude, Longitude based on their IP, using the Maxmind Geolitecity database. (Accuracy: 98% for the Continent & Country; 69% for the City)
  • Display the Continent, Country, City statistics under the "Visitor/Locations and Provider" menu item.

Installation instructions

  • Download and unzip the attached plugin.
  • Copy the /GeoIP folder into your /plugins folder in your Piwik installation directory.
  • Get the geolitecity database file here and extract it. (This file is to big to be attached along with the plugin in this ticket).
  • Rename the GeoLiteCity.dat file to GeoIP.dat, and move it to the /plugins/GeoIP/libs folder.
  • Edit your /config/global.ini.php file, and add the following lines:
[Plugins_LogStats]
Plugins_LogStats[] = GeoIP
  • In your Piwik web interface, go to the administration interface. In the Plugin tab, you should see a line for the GeoIP plugin. Click the corresponding "Activate" button.

Notes

  • No load testing has yet been conducted on this plugin.

To do

  • Provide a tool to migrate the location information of the legacy data.
  • Modify the last visitor report plugin (see #44) and add a column for the city.
  • Provide visualisation on a map in the last visitor report plugin with the latitude/longitude data.
  • The geoip database can be integrated through an apache module. Get the data from this module when available.

04/09/08 23:31:34 changed by matt

  • status changed from closed to reopened.
  • resolution deleted.

Great job so far mikael, any testers out there? feel free to comment by login & posting a comment here!

04/13/08 07:35:50 changed by mikael

  • attachment GeoIP_0.2.zip added.

04/13/08 07:41:49 changed by mikael

I released GeoIP plugin 0.2, hacking a translation issue:
The country and continent names were read from the UserCountry plugin, so when that plugin was disabled, an exception "unknown translation string" was thrown.
It is a temporary fix, I need to properly correct this using Piwik I18N management, for which I miss information at the moment. The clean correction should be released soon. (within the week)

04/13/08 09:15:43 changed by mikael

You can have a look at the GeoIP plugin in action here. logn/pwd: demo / demodemo.

There is not loads of stats (the monitored url is my New-Zealand trip blog, which does not yet attract so many people - yet there are visitors from a few countries.

(follow-up: ↓ 11 ) 05/29/08 04:38:40 changed by matt

The plugin is broken with the latest Piwik version. Mikael, can you please have a look (the fix is very easy, we cleaned up the constants and you don't need the PIWIK_PLUGINS_INCLUDE_PATH anymore)

06/02/08 22:33:27 changed by craig

Just downloaded Piwik today and the 0.2 plugin. I get this error when I go to the ADMIN page:

Fatal error: Can not call constructor in C:\Websites\LeaveMyChildBehind\stats2\plugins\GeoIP\GeoIP.php on line 20

I am running on Win 2003, IIS (yeah, I know ...) Any idea? -Craig

(in reply to: ↑ 9 ) 06/03/08 19:51:15 changed by craig

Replying to matt:

The plugin is broken with the latest Piwik version. Mikael, can you please have a look (the fix is very easy, we cleaned up the constants and you don't need the PIWIK_PLUGINS_INCLUDE_PATH anymore)

Can I get a copy of your changes? craig@LeaveMyChildBehind.com

06/08/08 23:15:58 changed by mikael

Hi - as Matt said, few changes in the core Piwik required changes in the plugins. I am working on that. Globally fixed but still some pb with the plugin install process - it should be fixed within the week.

07/01/08 03:45:13 changed by mikael

  • attachment GeoIP_0.3.zip added.

07/01/08 03:46:13 changed by mikael

Attached the corrected files

GeoIP_0.3.zip

Note: the installation process has been slightly simplified - there s no need to manually edit the config/global.php config file.

Installation instruction:

  • Download and unzip the attached plugin.
  • Copy the /GeoIP folder into your /plugins folder in your Piwik installation directory.
  • Get the geolitecity database file here and extract it. (This file is to big to be attached along with the plugin in this ticket).
  • Rename the GeoLiteCity.dat file to GeoIP.dat, and move it to the /plugins/GeoIP/libs folder.
  • In your Piwik web interface, go to the administration interface. In the Plugin tab, you should see a line for the GeoIP plugin. Click the corresponding "Activate" button.

07/01/08 04:13:38 changed by craig

I get this error ...

Uncaught exception: 'Class Piwik_DataTable_Filter_ColumnCallbackAddMetadata does not exist' More information

07/01/08 04:19:29 changed by mikael

You need to update your version of Piwik - I need to check the minimal piwik version