Closed (fixed)
Project:
Visitors (Web Analytics)
Version:
6.x-0.34
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Aug 2009 at 11:42 UTC
Updated:
24 Sep 2011 at 14:41 UTC
I am looking for a visitor statistics sorted by country. This of course requires a IP to country conversion. Do you consider implementing such a feature?
Comments
Comment #1
gashev commentedYes. I can implement it to future releases. In the next releases I want to add date filters.
Comment #2
roball commentedGreat news - thanks! I like your module because of its simplicity.
Comment #3
roball commentedAny status update (after one year passed)? I would suggest to depend on the GeoIP API module as an interface to the (free) GeoLite City database.
Thanks for letting the community know where your plans are currently.
Comment #4
beyond67 commentedIm interested in this also. Another great feature would be to make the ip address on the visitor pages to be links to a ip tacker (internal or external : http://www.ip-adress.com/ip_tracer/ ) that would list the country, state, ISP.
Comment #5
roball commentedgashev, I may be able to sponsor this task.
I would suggest to rely on the GeoIP API module and using the "GeoLite City" database file ("GeoLiteCity.dat"). Then you could add a new SQL table called something like "visitors_ips" which resolves each IP address to the Geocode data (country code, city name, latitude and longitude - in a similar way the Visitor Info module 6.x-2.0 does it) and add a button to refresh all these data based on the existing visitors_ip values.
What do you think?
Comment #6
gashev commentedHello.
I think it's not good solution use another table "visitors_ips" which resolves each IP address to the Geocode data.
If I understand correctly, you want added ip address to visitors_ip table on first request from some ip. On next requests record already exist into visitors_ip table and I don't need to check geo location info.
It's good if geocode data not change with time. May be, for some ip city, country, isp, etc changed with time.
On this, I'll add geocode data (country code, city name, latitude and longitude, etc) to visitors table and calculate geocode data on every request.
Comment #7
roball commentedThank you for coming back. Yes, that was my idea - to store each IP address only once (in a dedicated table) and look there at new requests, if it is already existing, instead of resolving it again and again.
But you are right, the same IP address may resolve to a different location at different times. Thus your suggested way to resolve each IP on each and every request is more accurate (at the cost of speed maybe). I am totally fine with this method as well.
Only for the existing IP addresses (from the time prior to supporting the IP resolving feature) we need to have a button that resolves them.
As mentioned I may be able to fund your work for implementing this. Are you interested?
Comment #8
gashev commentedAdded to 7.x-1.0-alpha1.
Installation.
1. Install geoip pecl extension. For installation instructions see http://www.php.net/manual/en/geoip.installation.php.
2. Download Geo Lite City database.
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
mv GeoLiteCity.dat /usr/local/share/GeoIP/GeoIPCity.dat
3. Find php.ini.
4. Enable extension to load in php.ini:
extension=geoip.so
5. Set to php.ini
geoip.custom_directory=/usr/local/share/GeoIP/
6. Apache restart.
7. On update visitors module run update.php.
Visitors table. Added new columns:
`visitors_continent_code`,
`visitors_country_code`,
`visitors_country_code3`,
`visitors_country_name`,
`visitors_region`,
`visitors_city`,
`visitors_postal_code`,
`visitors_latitude`,
`visitors_longitude`,
`visitors_dma_code`,
`visitors_area_code`.
Added new reports:
1. Countries report. View pages count per country.
2. City report. View pages count per city.
3. City visitors report. View city hits.
New records to visitors table will be added with geoip data.
Comment #9
roball commentedThese are excellent news, thank you so much! However, I am yet not using D7 and thus would need a D6 compatible version. Do you plan to release 6.x-1.0-alpha1 as well?
Comment #10
gashev commentedThank you.
I'll release 6.x version with geoip support.
Comment #11
gashev commentedComment #12
roball commentedThank you very much. Just upgraded 6.x-0.34 to 6.x-1.0-alpha1 and the Countries report works fine.
Just one problem: How can I re-compute the values of the 11 new geoip fields in the visitors table of all existing rows?
Comment #13
gashev commentedI'll write external script to update old values. Data can be too much and I do not want update all data to update module.
Comment #14
roball commentedThanks a lot - I have created a separate issue #1275090: Add script to update existing GeoIP fields for the external update script.