UserCountry stats are wrong

User country stats are wrong. For example, a lot if visitors detected as United States, but they aren’t. By comparing weekly country statistics to other stats (awstats, webalizier, custom scripts) only Piwik a lot of errors regarding to country detection - all other stats almost match, but Piwik shows strange and sometimes impossible values.

I tried to connect Piwik with GEOip (0.5.2), but got the following error:

[Wed Feb 11 13:01:24 2009] [error] [client 81.23.138.34] PHP Fatal error:  Uncaught exception 'Exception' with message 'Error query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'location_geoip_latitude' cannot be null' in /usr/home/piwik/www/core/Tracker/Db.php:193\nStack trace:\n#0 /usr/home/piwik/www/core/Tracker/Visit.php(243): Piwik_Tracker_Db->query('INSERT INTO piw...', Array)\n#1 /usr/home/piwik/www/core/Tracker/Visit.php(105): Piwik_Tracker_Visit->handleNewVisit('752', false)\n#2 /usr/home/piwik/www/core/Tracker.php(60): Piwik_Tracker_Visit->handle()\n#3 /usr/home/piwik/www/piwik.php(47): Piwik_Tracker->main()\n#4 {main}\n  thrown in /usr/home/piwik/www/core/Tracker/Db.php on line 193, referer: http://www.site.com/SiteClientScope/index.aspx?id=34&s=2

I changed location_geoip_latitude and ‘location_geoip_longitude’ to allow “NULL” values, but error still exist and GEOip widget shows no data…

Any suggestions?

piwik is per default using browser language to determine user country.

post bugs of geoip plugin here: http://dev.piwik.org/trac/ticket/45

regards

That said, there’s a bug in Language and Country detection (see ticket #504).

Good news: GeoIP is now integrated in Piwik, enabling Accurate Visitors Geolocation in your Analytics reports. To enable GeoIP go to the Settings > Geolocation admin page, and follow the short instructions.

You can also get an even more accurate Country & City Database from here to enjoy top accuracy in detecting your visitors locations.

See also the documentation about Geolocation - Analytics Reports in Piwik.