GeoIp Plugin
Requirements
You need at least Piwik 0.2.33 to run the GeoIp plugin.
How to install?
How to apply the GeoIp to all your previous visits to fix your previous reports
You can apply GeoIP precise localization on your past data:
Authors
Changelog
Feedback
Please leave a comment if you have any feedback, suggestion, or bug report.
Keywords: third-party-plugin
Attachment: Makes the plugin work when GEO ip is installed as PECL Extension
UsePeclExtension.patch
Attachment: 0.18
GeoIP.zip
Attachment: I patched GeoIP.php to get it working with the new world map widget. The only thing I changed was to add a column for the GeoIP region code that is returned by the API but wasn't stored in the Piwik database. However the map needs this region code to fill those nice country region maps with colors :)
GeoIP.php
Attachment: 0.18 with minor changes (disabled row evolution, region changes by greg)
GeoIP.2.zip
Thanks for the wonderful work on this plugin, it's really great!
Just wanted to add my little contribution with a little feature I use and thought I would share.
By applying the patch 'patch_GeoIP_0.7_google_map_link' I just uploaded to the original tree it adds links to google maps with the location of cities in the visitor countries dropdown...
mike5464 and rembrand, the plugin should show "Unknown" when the visitor couldn't be located. It will only work well from the upgrade and not fix previous visits. Do you still experience the issue few days after the upgrade?
You're using mod_geoip, right? Here's an excerpt from my apache conf:
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPEnableUTF8 On
GeoIPOutput Env
GeoIPDBFile /path/to/GeoLiteCity.dat MemoryCache
GeoIPScanProxyHeaders On
</IfModule>
Furthermore, check permissions on GeoLiteCity.dat, try chown <apacheuser> /path/to/GeoLiteCity.dat
wrote a small php script to test the Funktion of Geoip:
<html>
<body>
<?php
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) )
{
$locationInfo = array();
$locationInfo['country_code'] = (isset($_SERVER['GEOIP_COUNTRY_CODE'])) ? strtolower($_SERVER['GEOIP_COUNTRY_CODE']) : self::$defaultLocationInfo['country_code'];
$locationInfo['city'] = (isset($_SERVER['GEOIP_CITY'])) ? utf8_encode($_SERVER['GEOIP_CITY']) : self::$defaultLocationInfo['city'];
$locationInfo['latitude'] = (isset($_SERVER['GEOIP_LATITUDE'])) ? round($_SERVER['GEOIP_LATITUDE'],4) : self::$defaultLocationInfo['latitude'];
$locationInfo['longitude'] = (isset($_SERVER['GEOIP_LONGITUDE'])) ? round($_SERVER['GEOIP_LONGITUDE'],4) : self::$defaultLocationInfo['longitude'];
}
var_dump($locationInfo);
?>
</body>
</html>
Output : array(4) { [ string(2) "de" "city"=> string(7) "Hamburg" [ float(53.55) "longitude"=> float(10) }
Piwik still displays UserCountrycountry for new requests...
I've extended the GeoIP plugin to track in detail (In the US and Canada) which state or region the visitors are from, by adding an extra column to the database (region) and making minor changes to the code. The region can be query from the maxmind db. I was wondering if this feature can be made public?
duylaiabc, can you please post a screenshot of how the reporting look like?
it tried to get location_geoip_latitude, location_geoip_longitude from api.
I added this two columns to archiveDayAggregateVisits sql query and added
if(!isset($this->interestByCountryAndCity[$row['location_geoip_country']][$row['location_geoip_city']]['loc']))
$this->interestByCountryAndCity[$row['location_geoip_country']][$row['location_geoip_city']]['loc']=array('lat' => $row['location_geoip_latitude'], 'lon' => $row['location_geoip_longitude']);
But the result is, most of the data have wrong lat and long values. E.g.:
<row>
<label>Vienna</label>
<nb_visits>2</nb_visits>
<nb_actions>11</nb_actions>
<max_actions>11</max_actions>
<sum_visit_length>330</sum_visit_length>
<bounce_count>0</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<loc>
<lat>96,4</lat>
<lon>32,7334</lon>
</loc>
<sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
</row>
<row>
<label>Leonding</label>
<nb_visits>1</nb_visits>
<nb_actions>17</nb_actions>
<max_actions>17</max_actions>
<sum_visit_length>721</sum_visit_length>
<bounce_count>0</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<loc>
<lat>48.2667</lat>
<lon>14.2500</lon>
</loc>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
</row>
as you can see, loc data of Leonding is correct, but data of Vienna isn't.
Has anybody an idea why?
for people with limited memory you can replace
$this->geoIpDb = geoip_open($geoIPDataFile, GEOIP_MEMORY_CACHE);
into
$this->geoIpDb = geoip_open($geoIPDataFile, GEOIP_STANDARD);
in GeoIP.php
Replying to matt:
Replying to mvanlaar:
Is it possible in future version also build a version that can lookup againt a mysql table with the data from citylite?? The file version is very slow under load. And allowing more executing time isn't (imho) a solution.
for more performance the best solution is to install the Mod GEOIP on your apache server. geoip lookups will be lightning fast!
I tested this with the MySQL version of the maxmind database (!http://ipinfodb.com/ip_database.php) and modified the plugin to perform a mysql lookup instead of the binary database and ran the update script several times. A lookup via MySQL takes about 25% longer than the current version and the mysql tables take up about 300 MB. So it's no benefit whatsoever.
Is this plugin still in development? I would like to use the data from this plugin to show the visitors on Google Maps (or another map service)...
DaSilva, you are welcome to contribute to the plugin. Ideally, you would post a screenshot and a link to your example piwik with the plugin installed so we can have a look and provide Feedback. When your work is done, we can consider including it in the GeoIp plugin.
Replying to thibaut:
So if anybody has the possibility to craft a GeoIP version (or a working fix) that would run with 0.5.4 I (as many others I'm sure) would greatly appreciate !
I don't know what your problem is, but I have been using this plugins for months, and it is still working with 0.5.4 on my server.
I have all the time the "unknown" problem and sometimes "UserCountrycountry--" - but most of the time the country-detection works fine.
I tried everything :(
Same with o.5.1 - so I installad a complete new 0.5.4 with the actual GeoIP from this page and downloaded a new database-file. I followed the instruction one by one. I am sure everything is in the right directory.
Has someone some steps I could try?
Replying to anamela:
Now I am using (@theodorius123 that should work for you, too!):
if(!defined('PIWIK_INCLUDE_PATH')) { define('PIWIK_INCLUDE_PATH', '../../..'); } if(!defined('PIWIK_USER_PATH')) { define('PIWIK_USER_PATH', '../../..'); }
Then running the script from the command line SHOULD FUNCTION.
yes! Thank you! :)
mmh. this is not realy working for me.
857 rows to process in piwik2_log_visit...
Fatal error: error traversing database - perhaps it is corrupt? in /users/theo/www/piwik/plugins/GeoIP/libs/geoip.inc on line 422
and instead of cities i see all the time "Unknown"
:-(
After installing everything except this step "For more performance, it is recommanded to install the module apache mod_geoip. Configure your Apache according to:" piwik tracks nothing anymore. After deactivation everythings works fine.
I changed all my previous reports. I've changed the PIWIK_INCLUDE_PATH to my local path in the geoipUpdateRows.php. After that change i could update all my old reports and it works fine. But the problem now is that I couldn't track any new visitor.
php 5.2 + mysql 5.0.X SLES 10.3 distribution.
GeoIP v0.12, piwik 0.5.4
GeoIP.php: updateExistingVisitsWithGeoIpData does not work for me. It only updates one record per each block on limit. Pretty much "while ( $row = $stmt->fetch() )" works for one record only.
Changed above line 346 "while ( $row = $stmt->fetch() )" to these two lines.
$allRows = $stmt->fetchAll();
foreach ($allRows as $row)
works fine after the change.
By the way, using geoipUpdateRows.php script from command line only.
Is it possible that in the archived data the latitude and longitude will be stored in the database. Would like to use this for a maps plugin.
In Piwik 0.6, there is a backward incompatible API change in the archiving code.
All GeoIP users will need to upgrade to the latest GeoIP pluginafter they upgrade Piwik to 0.6. Piwik will automatically disable the GeoIP plugin during the upgrade to 0.6.
Hi, I have recently installed the latest version of Piwik .5.5 and it all works fine. I then installed Geoip and again it worked except I get the following problems...
Country (GeoIP)
UserCountrycountry 218
and
Continent (GeoIP)
UserCountrycontinent 218
I have looked through this thread and do not see a solution? Is there one and if so what can be done?
regards,
Blair
Hi,
I developed some kind of patch to store regions more than city (I find it more practice).
You can find it here : Region display patch. Explanation in french (sorry) here : Region display explanations.
Please feel free to tell me if you see something wrong in this patch.
Replying to e.marguin:
Hi,
I developed some kind of patch to store regions more than city (I find it more practice).
You can find it here : Region display patch. Explanation in french (sorry) here : Region display explanations.Please feel free to tell me if you see something wrong in this patch.
Hello,its possible to find any English version of this?
Also it's possible to redirect users from mobile/smart phones to a different page?
THanks,
Mike
ok i'll just try to translate here the main things (i'm sorry by advance for my poor english)...
The geoip module gives us information about the city of visitors. But often we do not know this city because it's too small. That's why I prefer to display regions, like in the other web analyzers tools.
The patch give upper stores the region name in db instead of the city name.
To install it, just extract it into the plugin/GeoIP/ folder.
It do not update old datas. It's technically possible but I didn't need it. If anyone really wants me to write this script, I can.
Eric
Replying to e.marguin:
ok i'll just try to translate here the main things (i'm sorry by advance for my poor english)...
The geoip module gives us information about the city of visitors. But often we do not know this city because it's too small. That's why I prefer to display regions, like in the other web analyzers tools.
The patch give upper stores the region name in db instead of the city name.
To install it, just extract it into the plugin/GeoIP/ folder.
It do not update old datas. It's technically possible but I didn't need it. If anyone really wants me to write this script, I can.Eric
ok,thank you ERIC.
I will give it a try.
mike3050, please don't add links to your websites in the trac comments, thank you.
Hi,
I'm happily (== both from app&sys perspectives) running Piwik 0.6.1 + GeoIP using the DB file w/o _modgeoip. Found a minor (at this time) issue: Country numbers don't match with Continent numbers for Europe, where the sum is always minor than the number obtained by summing all the single countries, see below. I'm wondering if this is a bug in the code or in the lookup table.
|| Country (GeoIP) ||||
|| Country || Unique visitors ||
||Italy || 997 ||
||Unknown || 66 ||
||United States || 5 ||
||Ireland || 3 ||
||Great Britain || 3 ||
||Poland || 2 ||
||Bulgaria || 1 ||
||Russia || 1 ||
||Switzerland || 1 ||
||Germany || 1 ||
|| Continent (GeoIP) ||||
|| Continent || Unique visitors ||
||Europe || 959 ||
||Unknown || 66 ||
||North America || 5 ||
Replying to snowdiver:
I experience the problem, that the GeoIP data is always saved as "unknown" in the piwik_log_visit table without any city labels, latitude etc.
I installed the plugin according to your instructions above. GeoIP ver 0.13, piwik ver 0.6.1 GeoIPCity (May 2010)
Is there any hint to fix this problem?
Thanks
EDIT: Problem solved. The apache module is installed on my server, but doesn't provide enough geo-information. Switching the module-search off fixed this problem!
Replying to snowdiver:
EDIT: Problem solved. The apache module is installed on my server, but doesn't provide enough geo-information. Switching the module-search off fixed this problem!
sorry, i am not that fit with all these server, php, etc stuff. i am using piwik and geoip and have the same "unknown" problem. but i dont have an own server, my homepage is on a freehoster-server (bplaced.net). is it possible to do what you did when i am using a free-hoster??
thanks!
theo
Replying to theodorius123:
Replying to snowdiver:
EDIT: Problem solved. The apache module is installed on my server, but doesn't provide enough geo-information. Switching the module-search off fixed this problem!
sorry, i am not that fit with all these server, php, etc stuff. i am using piwik and geoip and have the same "unknown" problem. but i dont have an own server, my homepage is on a freehoster-server (bplaced.net). is it possible to do what you did when i am using a free-hoster??
thanks!
theo
My homepage is also hosted on bplaced.net servers, so we met the same problem. It is just a small modification of the GeoIP.php file. Just remove or comment lines 230-234 to force the plugin to use the GeoLiteCity.dat file instead of the Apache Module, which in the bplaced.net case does not provide information about the city of a visitor.
The most frequent "city" in my stats is "unknown". Any suggestion for a better geoip database? I'm concerned only with Brazil, FWIW.
All users experimenting issues with the geoipUpdateRows.php script, we have fixed a few bugs reported by users in this thread. Check out the new GeoIP 0.14 version.
If you still have issues, please report here, we'll do our best to fix it.
Users that are seeing a lot of 'unknown' countries and cities, this is probably due to the low coverage of the Free IP to country database provided by MaxMind. If anyone knows a better DB, let us know! You can alternatively buy the MaxMind pro DB, but I haven't tested how accurate this DB is.
How do I know if a database is in the file format for GeoIP?
I seem to have some problem with the geoipUpdateRows.php script. What I can see, nothing happens when I run the script, all older data is just NULL, newer data from the same IP is however marked correctly.
btw:
could it be that the geo-ip colums stay in the db after plugin deactivation?
Is this bahavior wanted?
With the last version, i still get this error.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, postmaster@www.climb2climb.be and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
I'm trying to run the latest version of this plugin on Piwik 0.9 and all I seem to be getting is UserCountrycountry as Blair noted in Comment #101. Has anyone found a solution for this?
I had a problem of exit without error and no log of my visits, i followed this:
Replying to marcello.ceschia:
for people with limited memory you can replace
$this->geoIpDb = geoip_open($geoIPDataFile, GEOIP_MEMORY_CACHE);
into
$this->geoIpDb = geoip_open($geoIPDataFile, GEOIP_STANDARD);
in GeoIP.php
and it worked, on a dedicated server with 2Go of ram ...
From forum post GeoIP just show true country in "Locations & Provider" and it doesn't show true country in "Visitor Log", "world map" and "Live Visitors!"
If the GeoIP plugin writes to "the existing country & continent columns", then what should it write when the country is unknown? In my experience (YMMV) that's the second most frequent "country". The IP is already stored by Piwik, so if the geolocations are to be stored by GeoIP, each database should have its own columns in the database. Each database has its own limitation, and mixing information from more than one database in a single column would impair the user from using the correct precautions.
As you say, each database has its limitations. Each also has different operating characteristics (e.g., system requirements, memory requirement, disk space requierments, and lookup time). I proposed that users be able to pick and choose which one to use, if any.
Users generally expect/assume the existing country & continent columns to be geolocated. (We have a FAQ to explain why it isn't.) What we can do is that when the country/continent is unknown, the plugin fallback to what we do now when GeoIP isn't installed/activated, i.e., guess the country from the Accept-Language header; and if that fails, then write 'xx'.
I agree that the existing country & continent columns should be geolocated when possible, with a fallback to the no-plugin behavior on "unknown" results. Would it be possible to fall back to the actual "faux geolocation" code that populates those columns now so there isn't code duplication in the plugin?
I can't think of a case where this would worsen the data in the existing columns. It's going to be either an improvement (when there is GeoIP data for the IP, which "outranks" a guess from the language header) or no change (when there is fallback to the language header code).
I'd also be interested to know if the paid version of the GeoIP database cuts down significantly on the number of unknowns. I do get valuable information from the 30% or so of my traffic that shows up in GeoIP as "unknown" - since I know the GeoIP database coverage of USA addresses is very high, I can reasonably assume that most of that traffic is from outside the US. It does look like the language-header method guesses USA for a lot of non-US addresses.. and for all my traffic from India.
Turned out to be a very simple patch. I think this is low risk - it leaves location_country alone unless GeoIP knows what the country is. Ran it against the historical visits on my end and the Core and GeoIP "Visitor Countries" widgets are now much closer. No "unknowns" showed up in the Core widget, but India, which had been completely absent, is there now. (Pretty much everyone in India has their browser language set to English/US, apparently..)
I would appreciate feedback/review, this is my first submitted Piwik patch.
Hi,
I am using piwik 1.0.
I get the following error (same as reported above a few times):
UserCountrycountry
How can I visualize the countries and continetns instead of UserCountrycountry and UserCountrycontinent respectively?
GL
I've been using this plugin for two weeks. With American cities, it would be help me to display them as "Springfield, MA" rather than just "Springfield". Often the city name won't mean much to me on its own but the state will.
(Showing postal abbrevations for states and provinces in other countries would be welcome too, but I wouldn't be a good test user for that.)
GeoIP is activated but only shows the correct country entered visitors> location.
But in the plugins UserCountry, UserCountryMap, live, continents, are the wrong country and continent.
I am from Ecuador South America continent, Spanish, shows such as Spain, mainland Europe Spanish.
I searched for information but can not find clear and specific answer to this problem.
How I can fix it?
If I'm correct in Piwik demo is not activated or installed GeoIP, however UserCountryMap plugin register, live, UserCountry, etc, Ecuador South America visits.
What I can do to register the countries and continents as they recorded a demo of Piwik?
Esteban
Estaban: download and install GeoIP, and apply the patch from Ian in comment:142
Replying to vipsoft:
Estaban: download and install GeoIP, and apply the patch from Ian in comment:142
Replying to ian:
Turned out to be a very simple patch. I think this is low risk - it leaves location_country alone unless GeoIP knows what the country is. Ran it against the historical visits on my end and the Core and GeoIP "Visitor Countries" widgets are now much closer. No "unknowns" showed up in the Core widget, but India, which had been completely absent, is there now. (Pretty much everyone in India has their browser language set to English/US, apparently..)
I would appreciate feedback/review, this is my first submitted Piwik patch.
Excellent! problem solved.
Thanks
But not as Piwik demo is not on the GeoIP plugin (no I'm not mistaken) yet recorded Ecuador South America
Why?
Esteban
Country-to-continent assignment is via a lookup table. In Piwik 1.0, Central America is lumped in with South America.
For Piwik 1.1, we're using the Maxmind GeoIP mapping with the exception of Central America (which they lump in with North America). We've added Antarctica and Central America as separate continental regions.
Replying to vipsoft:
Estaban: download and install GeoIP, and apply the patch from Ian in comment:142
Hi,
How do I apply the patch?
I'm not used to work with diff files.
Replying to poudro:
By applying the patch 'patch_GeoIP_0.7_google_map_link' I just uploaded to the original tree it adds links to google maps with the location of cities in the visitor countries dropdown...
hi! google-map-links are working, unfortunately piwik seems to accumulate the longitude and altitude numbers, so the links of cities with more than one visitors are pointing to nirvana...
do you have an idea what i have to change in the code to correct this?
thx!
as you can see, loc data of Leonding is correct, but data of Vienna isn't.
Has anybody an idea why?
piwik is accumulating the longitude and altitude by archieving. but o don't know what i have to change...
Hi,
When the Geoip is installed as a PECL extension on your server the plugin doesn't work. The included geoip library redefines functions that are already defined by the PECL extension.
I made a patch which makes the plugin use PECL extension when available instead of including the geoip library.
@see UsePeclExtension.patch
Followed the instruction and installed plugin GeoIP. Also downloaded the lite .dat file.
Still all visitors are marked to come from the US.
Visitors -> Locations & Providers show no data for this report for both Country and Continent.
How do I check whether GeoIP plugin is configured correctly? It is enabled.
Much thanks!
BTW, the time log of visitors visiting the site is correct under Vistors -> Visitor Log.
Thanks again!
4 hours later the country automagically becomes 7 = unknown, 2 = asia, 1 = US. As I'm in Hong Kong, at least it now shows something other than US.
Does anyone know how long it takes for data to become available for reporting?
Note: before including GeoIP in trunk, GeoIP should be modified so that it records the new country and continent in place of the default one (columns location_*) , rather than in new columns locationgeoip in the log_visit table.
Thanks Matt for the pointer.
How should I go about making these changes?
I patched GeoIP.php based on this file GeoIP-set-location_country.diff, and now there is no logging of access.
Phew....
If this is a candidate for trunk, I advise renaming it to Geolocation, since "GeoIP" is a trademark. Also, by using a generic, vendor-neutral name, we would be able to add adapters for other geolocation methods/services/products.
I think GeoIP should move to core. This will improve user experience and allow for better Piwik features in the future, such as mapping cities and regions in the world map.
I created a ticket with proposed ideas: #1823
I tried applying the patch http://issues.piwik.org/attachments/5465/GeoIP-set-location_country.diff but could not get it done.
I used Netbeans before to patch my drupal files but this one seems to have a different file format. Where can I find anything on how to patch under windows?
I got it done, seems netbeans can not read that patch format and i found GNUWin worked
I get nearly only unknown users after downloading the version off the description and patching it (I as well run the update php and dropped the tables).
Where do I find the latest version and do I still need toapply the patch ian posted?
This site is pretty confusing to new users. I can find nowhere to get the versions listed.
Or is there a solution to this
UserCountrycountry
UserCountrycontinent
issue I missed??????
I tried running the script from borwser and command line now. Nothing. ALL of my first user do show up under these lables. I read somewhere above they can not be updated? But what does the script then? If I understand it right The script should query the old data and update the database?! Any help or removing of my confusion would be appreciated :D
What I need to mention:
I did patch before I used GeoIP the first time but I can remember at the second time I ran the script it got 1 lower. I somewhere above read the loop before did only one update - So may there possibly still be a problem?
if I might add to this. The maxmind db gives a city lookup. This does not work how people think it will. Blocks of IP numbers are sold to to service providers who resell to end users. However, the IP issuing authority assign the city of the ISP address to all the IP numbers. At least that is how it works in the UK. Things may vary in different countries and ISPs don't reallocate city when they sell dedicated IP numbers to end users. The result is that city lookup generally only gives the city of the ISP and not where the visitor is visting from. The ISP can be anywhere in the country and hundreds of miles from where the visitor is based. In other words, city lookup is useless except for giving the location of ISPs. This also means that lat long is useless too since it seems to be based on city lookup. When IPV6 is rolled out and if, and only if, ISPs allocate city to users when they purchase a fixed IP then city lookup may become useful. But many ISPs still use dynamically allocated IPs so it wouldn't work in that case either. In short the concept of providing city and/or lat/long of vistors is fundamentlly flawed.
When new visitors appear on the LiveVisitors screen, they initially have the "wrong" flag as with the standard identification by browser settings. Only overnight does GeoIP override the IDs with its correct geodata.
How can I change the interval so that the correct identification would be instant or at least happen faster? Great plugin btw.
UserCountrycountry
UserCountrycontinent
Is there any solution for this?
Thanks, j
Replying to tlitody:
if I might add to this. The maxmind db gives a city lookup. This does not work how people think it will. Blocks of IP numbers are sold to to service providers who resell to end users. However, the IP issuing authority assign the city of the ISP address to all the IP numbers. At least that is how it works in the UK. Things may vary in different countries (...)
There is a page on the MaxMind website with a list of the accuracy at country and city level for the GeoLite City database. For the UK they report quite a low accuracy indeed (56% within 25 miles of true location), but for many other countries they do report fairly accurate values (e.g. for the US they report 78%).
https://www.maxmind.com/app/geolite_city_accuracy
Published the new GeoIP version for Piwik 1.2 and more.
If you upgrade to Piwik 1.2, you can also apply the following patch rather than downloading the new plugin:
136c136
< count(distinct visitor_idcookie) as nb_uniq_visitors,
---
> count(distinct idvisitor) as nb_uniq_visitors,
177c176
< $query = $archiveProcessing->queryConversionsBySegment("location_geoip_continent,location_geoip_country,location_geoip_city");
---
> $query = $archiveProcessing->queryConversionsByDimension("location_geoip_continent,location_geoip_country,location_geoip_city");
I am getting an error message when I try to run the update script. I don't know enough php to figure this out, but I'm assuming paths have something to do with it.
$ php /home/me/website.com/piwik/plugins/GeoIP/misc/geoipUpdateRows.php
Warning: require_once(../../../core/testMinimumPhpVersion.php): failed to open stream: No such file or directory in /home/me/website/piwik/plugins/GeoIP/misc/geoipUpdateRows.php on line 23
Fatal error: require_once(): Failed opening required '../../../core/testMinimumPhpVersion.php' (include_path='../../../core:../../../libs:../../../plugins') in /home/me/website/piwik/plugins/GeoIP/misc/geoipUpdateRows.php on line 23
kip: the script expects to be run from within the same folder
cd /home/me/website.com/piwik/plugins/GeoIP/misc
php geoipUpdateRows.php
Just installed the new version -- thanks for the fix.
While you're updating, there might be an easy change to make U.S. data a lot more intelligible. Given how hard it is to recognize city names, or distinguish the same city name in multiple states, the two-letter state abbreviations are super-useful:
Will you consider displaying the states for U.S. cities -- e.g. "Springfield, MA" instead of "Springfield"?
Thanks for piwik 1.2 and this update. Do I have to apply the files in the Updates directory in any way? (07.php, 09.php)?
I've added " (GeoIP)" to my local en.php and de.php for 'GeoIP_WidgetContinents' and 'GeoIP_WidgetCountries', so that I can distinguish between the normal and the GeoIP widgets. I suggest doing this officially as well. I know that in the forums there have been several requests about GeoIP working at all because people couldn't see a difference.
One question: I installed the plugin and followed the instructions. GeoIP widget is also shown in piwik. But somehow it doesn't seem to work properly. Piwik shows my IP (79.205.251.97) as "United States" based on my browser locale (which is "en_US").
When I use the geoiplookup command line tool using the same database file "GeoLiteCity.dat" it shows the correct:
$ geoiplookup -f GeoLiteCity.dat 79.205.251.97
GeoIP City Edition, Rev 1: DE, 16, Berlin, N/A, 52.516701, 13.400000, 0, 0
Did piwik cache the result somehow? Should I worry?
Grateful for any suggestions...
buzz
buzz: for performance, geolocation only happens on the first page of a new visit. You either have to wait out the session timeout, or clear your cookies to be treated as a new visitor.
i downloaded the new zip file and have the following errors
Fatal error: Call to a member function filter() on a non-object in /homepages/39/d319160918/htdocs/i-sitekohchang/analytics/piwik/core/ViewDataTable/HtmlTable/AllColumns.php on line 52
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'visitor_idcookie' in 'field list'
off topic,,, this page (this track ticket) takes ages to load, a lot of comments for 1 page, can you split out the old comments on to a page 2/3..? a log in on the bottom of the page would also be nice :)
Replying to jekko:
i downloaded the new zip file and have the following (errors on the dashboard not when running geoipUpdateRows.php)
Fatal error: Call to a member function filter() on a non-object in /homepages/39/d319160918/htdocs/i-sitekohchang/analytics/piwik/core/ViewDataTable/HtmlTable/AllColumns.php on line 52
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'visitor_idcookie' in 'field list'
off topic,,, this page (this track ticket) takes ages to load, a lot of comments for 1 page, can you split out the old comments on to a page 2/3..? a log in on the bottom of the page would also be nice :)
Still got error even i Use the latest GeoIP.2.zip (20.2 KB) for Piwik 1.3
In order to use GeoIP within Piwik 1.3 I had to add 'require_once('ABSOLUTE_PATH_TO_PIWIK/libs/upgradephp/upgrade.php');" to core/Cookie.php and alter line 373 of core/Config.php, where I changed '_parse_ini_file' to 'parse_ini_file'. This is somehow not the intended behaviour, I guess. A bug?
fixed in the updated GeoIP.zip package; bumped the version to 0.15
re: page load time of this trac ticket -- this ticket will be closed as soon as we move this plugin into the core distribution; see #1823
Replying to vipsoft:
Sorry, repackaged.
oh dear!
Fatal error: error traversing database - perhaps it is corrupt? in example.com/analytics/piwik/plugins/GeoIP/libs/geoip.inc on line 422
Replying to jekko:
Replying to vipsoft:
Sorry, repackaged.
oh dear!
Fatal error: error traversing database - perhaps it is corrupt? in example.com/analytics/piwik/plugins/GeoIP/libs/geoip.inc on line 422
ah ok! the GeoLiteCity.dat did not move across.
now its ok but we don't have enough php memory to run it (host will not increase the php memory)
Replying to jekko:
Replying to jekko:
Replying to vipsoft:
Sorry, repackaged.
oh dear!
Fatal error: error traversing database - perhaps it is corrupt? in example.com/analytics/piwik/plugins/GeoIP/libs/geoip.inc on line 422
ah ok! the GeoLiteCity.dat did not move across.
now its ok but we don't have enough php memory to run it (host will not increase the php memory)
its trying to allocate 27 meg, that seems a lot
Fatal error: Out of memory (allocated 5242880) (tried to allocate 27629546 bytes)
Yes, it tries to load the geo database into memory. This is Maxmind's library so it is "by design".
The new geolocation plugin will offer more choices, esp for resource constrained environments.
Sorry, can't find information on this anywhere.
I had GeoIP working, updated Piwik to 1.2
and GeoIP hasn't worked since.
Tried to install again with most recent GeoIP.zip but keep getting the error
"Unable to load plugin 'GeoIP' because 'var/www/info/piwik/plugins/GeoIP/GeoIP.php' couldn't be found. You can manually uninstall the plugin by removing the line Plugins[] = GeoIP from the Piwik config file."
In piwik config.php.ini the line Plugins[= "GeoIP" has been removed but PluginsInstalled = "GeoIP" remains. (removing it didn't help either)
Any tips/things I should read?
Any help much appreciated
Remove references to GeoIP from your config.ini.php.
In your plugins/ folder, either remove the GeoIP folder, or re-upload the contents. (note: filenames may be case
sensitive)
Installed GeoIP v15 into a Piwik 1.3 and the plugin seems to be working (I had a look into the new widget and they show the cities correctly). What currently isn't working is the Visitor-WorldMap which I thought should show the new stats as well. Am I missing something?
SaschaVogt: that's because we haven't changed the GeoIP plugin to overwrite the standard columns
The GeoIP plugin is in maintenance mode as I'm currently working on its replacement in #1823.
Minor update in 0.16:
There is a bug in the updateExistingVisitsWithGeoIpData() function:
$row = Piwik_FetchOne($query);
...
$count = $row['cnt'];
Piwik_FetchOne($query) returns the count direct:
$count = Piwik_FetchOne($query);
Hi
I started using the geoip v0.17.
I am using it on Uniserver - it works fine without the GeoIP plugin enabled. After enabling that I gte this
"500 Internal error - The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, apacherrors and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log."
[notice] EACCELERATOR(2672): PHP crashed on opline 12 of exec() at C:\Uniserver\www\piwik\libs\Zend\Db\Adapter\Pdo\Abstract.php:263
[crit] Parent: child process exited with status 3 -- Aborting.
One another question - Is it possible to dump the csv into Mysql and query it from GeoIp? In that case, I guess there wont be any memory overhead or caching required - it might be a bit slower though
Replying to lc1:
as you can see, loc data of Leonding is correct, but data of Vienna isn't.
Has anybody an idea why?
piwik is accumulating the longitude and altitude by archieving. but o don't know what i have to change...
Did you ever find out what you need to change to avoid that problem? I have the same problem, so you might have some advice ..
Has anyone managed to display regionnames with 0.17 version ?
e.marguin's solution doesn't work, and only thing I achieved was region codes.
I can't force the codes to be converted into region names.
I feel it's stupid simple, but I'm too stupid to find the solution on my own :/
I use Piwik 1.5 and latest GeoIP. Piwik website shows unknown city data but in database the location_geoip_city has the correct entrys. Country and continent data are correct - only city data are "unknown". Is there a patch to re-enable this feature?
myam: disable eAccelerator -- it's not as stable as other opcode caches; yes, possible to query from a MySQL table but not planned for this plugin; for example, the new geolocation plugin in #1823 supports a table lookup for InfoDB's data
bavarian: I don't know where this is occurring; I'll see if it happens with the new plugin ...
controlc.de: make sure you're using the GeoLiteCity.dat (or GeoIPCity.dat); if you have mod_geoip installed, this plugin will use that instead, so make sure it's also using the city .dat file
Are there plans to patch Live/Visitor.php to use the plug in? It is confusing at the moment seeing different country identification on the user log and the locations. There is a suggested post in forum http://forum.piwik.org/read.php?2,71788,page=1#msg-71788 and in the following entry.
rafal: no because (1) GeoIP is not a core plugin, and (2) when we do move that functionality into core, it'll use the existing location_ fields.
vipsoft, thanks for answering. What is the expected timeline for including a geo functionality in the core?
Hallo,
I would like to ask if there is a way to have the city names translated?
;)
In the upcoming release, there is an extension of the segmentation API which breaks the GeoIP plugin.
In Piwik_GeoIP::archiveDayAggregateVisits, udpate $labelSQL = 'log_visit.location_geoip_continent';
This will prevent the archiving process from failing.
I might add the new features soon, but maybe you want to have a look at the changes and do it yourself. If you want to see the way the new querying works, have a look at Piwik_ArchiveProcessing_Day::getSimpleDataTableFromSelect: you need to use $segment->getSelectQuery. Note that all fields have to use a table prefix.
Thanks for the great plugin. Would it be possible to include displaying US/Canada regions (or all country regions) in the next release? I know this is available in the GeoLiteCity database, so why not use it. Regions would mean a lot more to me (in the USA) than cities. Thanks!
This new plugin sounds promising. But I hope you are going to also keep the old browser language/country detection, maybe named as such. I personally consider that language display equally important as the IP location display.
Following scenario: I'm on a travel around the world, and have a travel blog. People accessing that blog are often people I have met on the trip, often still traveling. Now, when I see my Piwik logs, the IP location (which I currently check manually) is surely interesting, but what tells me more about a visitor is actually his browser language. If you check the IP address I am writing this from, you will see that it is Malaysian. How much do I have to do with Malaysia? Nothing. My browser language is German of Germany, which tells more. And the combination of the two IP location and browser country (i.e. the current detection) actually provides one more detail: the visitor is most likely a traveler or an expat. I can imagine website who interested in that marketing information.
You would not believe how many travelers roam the world this days. And I would say most of them use the often free WiFi (at their place of stay, bars and restaurants all over Southeast Asia) with their own devices: Laptops, Phones, Tablets, etc. It seems to be the new way of travel, with people sticking their noses into displays half of their time, with most of that time on Facebook.
P.S.: Since there are countries with several languages (Belguim, etc.), but also countries with common language (UK, US, etc.), maybe both, the browser country and its language could be shown (if provided by browser). Additionally to the IP location provided by this plugin.
Replying to jawsmith:
This new plugin sounds promising. But I hope you are going to also keep the old browser language/country detection, maybe named as such. I personally consider that language display equally important as the IP location display.
...
Sorry, I apparently used wrong ticket. I copied my above comment to the ticket for inclusion of this plugin into core (#1823).
Hi,
first thank's for this great plugin but I've a problem with it.
When I looking for geodata of last week, month, year etc.
I get the message "There is no data for this report."
I checked whether the geoipUpdateRows the rows have been updated . All rows has been updated.
Have any an idea why the plugin gives no information?
Thx a lot
Info.
Piwik 1.6
GeoIP 0.18 (the versionnumber is not updated in plugin)
same problem with Piwik 1.5
GeoIP 0.17
Hi,
I'm running the plugin since quite a while and figured out that on my hosted web space the GeoLocation very often was set to "Unknown". Today I figured out that there is a difference whether the data is added "live" or whether the data is added by running the geoipUpdateRows.php. Basically in "live" operation it about 80% of the time fails to add the data and using the geoipUpdateRows.php script it succeeds by regenerating the data. Investigating the GeoIP.php code I figured out that on my webspace function "public function logGeoIPInfo($notification)" fails to detect whether "getLocationInfoModGeoip" is supported properly. Basically the function is able to retrieve the country but most times fails to gather the other geoip data.
I could fix this by changing:
public function logGeoIPInfo($notification)
{
$visitorInfo =& $notification->getNotificationObject();
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) )
...
into
public function logGeoIPInfo($notification)
{
$visitorInfo =& $notification->getNotificationObject();
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) && !empty($_SERVER['GEOIP_CITY']) )
...
Maybe this could help someone who is running in the same problem.
sun
Replying to matt:
From forum post GeoIP just show true country in "Locations & Provider" and it doesn't show true country in "Visitor Log", "world map" and "Live Visitors!"
Hi Matt, Can you please add this information in the top section "GeoIP Plugin" of the description and also add instructions for replacing respective widgets to the end of section "How to install?"? This will save people a lot of time troubleshooting. Maybe also cross-ref to #1823 to show users that integration into core is being worked on. Best regards, JJ
I have a question regarding the 'Email Reports'. What if I want to include the city in the pdf reports. Is it possible to add that as an option.
Thanks!!
I needed support for the MaxMind Organization database, so I have enhanced this plugin to allow for loading of multiple databases, &etc. This is based on 0.18 and tested under Piwik 1.6.
The diffs are straightforward. Apache mod_geoip support is not yet implemented, but forthcoming. I would like to get into the dev circle for this module so my enhancements may be included; I'd like feedback.
Where do I submit my changes for comments and feedback?
I was going to post a patch, but this plugin in not in the piwik application repository. U would love to contribute...
Hi,
I tried to install this plugin but when I want to activate the plugin in piwik, I have this error (piwik is installed via a lampp/xampp server) :
"Unable to load plugin 'GeoIP' because '/opt/lampp/htdocs/piwik/plugins/GeoIP/GeoIP.php' couldn't be found. You can manually uninstall the plugin by removing the line Plugins[] = GeoIP from the Piwik config file."
Backtrace:
#0 /opt/lampp/htdocs/piwik/plugins/CorePluginsAdmin/Controller.php(28): Piwik_PluginsManager->loadPlugin('GeoIP')
#1 function: Piwik_CorePluginsAdmin_Controller->index()
#2 /opt/lampp/htdocs/piwik/core/FrontController.php(132): call_user_func_array(Array, Array)
#3 /opt/lampp/htdocs/piwik/index.php(53): Piwik_FrontController->dispatch()
#4 {main}
But I have a file /opt/lampp/htdocs/piwik/plugins/GeoIP/GeoIP.php...
After installing the plugin (0.18) on Piwik (1.6) no more visitors were logged. Deactivating the plugin fixed the bug. Maybe I missed something?
Replying to sun:
I could fix this by changing:
public function logGeoIPInfo($notification) { $visitorInfo =& $notification->getNotificationObject();
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) )
...
>
> into
>
>
public function logGeoIPInfo($notification)
{
$visitorInfo =& $notification->getNotificationObject();
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) && !empty($_SERVER['GEOIP_CITY']) )
...
>
> Maybe this could help someone who is running in the same problem.
>
> sun
This works for me!!
Thanks !!!
I could fix this by changing:
public function logGeoIPInfo($notification) { $visitorInfo =& $notification->getNotificationObject(); if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) ) ...
into
public function logGeoIPInfo($notification) { $visitorInfo =& $notification->getNotificationObject(); if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) && !empty($_SERVER['GEOIP_CITY']) ) ...
Maybe this could help someone who is running in the same problem.
sun
Don't work for me =(
BTW: Piwik tell me that i have the versison 0.17, but i downloaded 0.18
Replying to greg:
After installing the plugin (0.18) on Piwik (1.6) no more visitors were logged. Deactivating the plugin fixed the bug. Maybe I missed something?
Same problem here. No logging at all since it was enabled.
Piwik plugin page says that the GeoIP plugin version is 1.17, but 0.18 was downloaded (from here) and installed. Seems that the version number was not updated (as stated in one of the comments above). (Or is the link/attachment wrong?)
File: GeoIP.zip
CRC-32: 946fe9c0
MD4: 097f8d10aaf2fec1a5a736eabda34445
MD5: 071eef0ec054d7dbc9408652f43d09ad
SHA-1: 266aee4fe6ff22a21298fd1ef45a5e4352ece920
Need your help.
GeoIP is installed, and the visitor Country is shown to be correct under page Visitors -> Locations & Provider
But in Dashboard and Visitors -> Visitor Log the country flag is always the US flag.
This makes things quite confusing.
Is this by design?
I'm using Piwik 1.7.
It seems this plugin is causing an error when archive.php is called in version 1.7.1
Any ideas?
The last GEOip update breaks Piwik. This is the error I got Fatal error: Cannot redeclare geoip_country_code_by_name() in /home/piwik/public_html/plugins/GeoIP/libs/geoip.inc on line 347
It took some time to find this error. I changed back to an older backupped GEOip version. This solves the error.
How to install GeoIP on high traffic website ? It would be nice to have a short documentation about it. High traffic documentation is something we usually find in other Piwik pages. I have 11.591.599 lines in piwik_log_visit, so the installation will take quite a long time.
After pressing the "Activate" button, I setted the maintenance_mode and turned off record_statistics but it would have been nice to have a proper CLI.
If you get a Fatal error: Cannot redeclare geoip_country_code_by_name() in /home/piwik/public_html/plugins/GeoIP/libs/geoip.inc on line 347 make sure geoip.so is disabled in php.ini
This php setting conflicts with the function geoip_country_code_by_name
When importing logs with the script provided in #703, IPs get geolocalized still the world map remains blank. Is there a way to make the GeoIP plugin work in way that is compatible with the World Map widget?
I just tried to install the GeoIP plugin on Piwik 1.71 and received the following error message:
Mysqli prepare error: This command is not supported in the prepared statement protocol yet
Any one else experience this or know the solution for it?
If mod_geoip is enabled and the Tracking API over HTTP with an individual IP (&cip=1.2.3.4) is used to create a new visit, then the IP-adress of the requesting server is used but not the individual IP. As a result, the GeoIP-location is always the location of the requesting server.
Workaround:
Change this
public function logGeoIPInfo($notification)
{
$visitorInfo =& $notification->getNotificationObject();
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) )
...
into
public function logGeoIPInfo($notification)
{
$visitorInfo =& $notification->getNotificationObject();
if( !empty($_SERVER['GEOIP_COUNTRY_CODE']) && $visitorInfo['location_ip'] == ip2long($_SERVER['REMOTE_ADDR']) )
...
The plugin does not use $archiveProcessing->shouldProcessReportsForPlugin()
in archiveDay and archivePeriod like all core plugins. When using segmentation, this causes serious performance overhead. Could you fix this?
Hi
I don't know if it's a bug in this plugin, but for me the cities in Piwik are not ordered with the correct countries. (See attached screenshot)
[[Image(http://www.imagehousing.com/image/1016342)]]
And I don't know where to look for the bug. - Any suggestions?
Best, MC
the version number in the zip is 0.17 ( should be 0,18)
The location fields do not seem to be updating, the fields are not populated
I i force an update using the ./plugins/GeoIP/misc/geoipUpdateRows.php
the do get populated.
Cheers Marco
Setup GeoIP as instructed with Piwik 1.7.1 and mod_geoip. Visitors are logged but always with City Unknown. (See attached screenshot). [http://i.imgur.com/aiSMJ.png]
Please advise, Thanks.
Hi,
I followed the below procedure for enabling GeoIP for my website.
1.Downloaded GeoIP plugin, extracted it and copied in the folder piwik/plugins/ on the server.
2.Downloaded GeoLiteCity.dat file,extracted it and copied in the folder piwik/plugins/GeoIP/libs/
3.And in the Piwik website I activated the GeoIP plugin by going to Settings-->Plugins.
Is that enough for enabling the GeoIP plugin and tracking the country?
For me,its showing that continent,country and city are "Unknown".
Is there any code to be embedded in the php page which I'm using for tracking?
If so,how to make API calls from my PHP page to the GeoIP API ( API.php in GeoIP plugin )
It is saying "Requested report GeoIP.getGeoIPCountry for Website id=XXX not found in the list of available reports. "
Thanks,
pol.
Plugin not working on the reports page after upgrade to Piwik 1.8
For more information please follow to this forum topic [http://forum.piwik.org/read.php?2,89689] for more details.
Plugin not working on the reports page after upgrade to Piwik 1.8
I'm having the same issue as pol and Globulopolis. I followed all the instructions and I'm still getting "Requested report GeoIP.getGeoIPCountry for Website id=XXX not found in the list of available reports."
Anybody working on this?
Thanks,
Kenegade
I am having some trouble with the GeoIP after the update to Piwik 1.8.2
The total visitor count in Piwik doesn't reflect the same total count in the GeoIP plugin.
Also, is there an update to this plugin to support IPv6 now?
Thanks
Reported in #3212: the GeoIP plugin does not support row evolution.
I patched GeoIP.php to get it working with the new world map widget. The only thing I changed was to add a column for the GeoIP region code that is returned by the API but wasn't stored in the Piwik database. However the map needs this region code to fill those nice country region maps with colors :)
I just installed the latest version. While it is working for new visitors, the update script geoipUpdateRows.php is not working. I tried it in the browser but there i only get a white page after a few seconds. When using a shell and using the command "php geoipUpdateRows.php" i get the following error:
PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in ***/piwik/plugins/GeoIP/misc/geoipUpdateRows.php on line 30
Content-type: text/html
<br />
<b>Parse error</b>: syntax error, unexpected T_OBJECT_OPERATOR in <b>***/piwik/plugins/GeoIP/misc/geoipUpdateRows.php</b> on line <b>30</b><br />
Line 30 is: Piwik_FrontController::getInstance()->init();
Any suggestions?
Hi! Thanks for this great plugin.
I'm having similar issues with the updated GeoIP.php file. Once updated, I tried running geoipUpdateRows.php through my browser and got the following message:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'location_geoip_region' in 'field list'' in /home/samtqcca/public_html/stats/libs/Zend/Db/Statement/Pdo.php:228 Stack trace: #0 /home/samtqcca/public_html/stats/libs/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1 /home/samtqcca/public_html/stats/libs/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) #2 /home/samtqcca/public_html/stats/libs/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) #3 /home/samtqcca/public_html/stats/libs/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('???????UPDATE p...', Array) #4 /home/samtqcca/public_html/stats/core/Db/Adapter/Pdo/Mysql.php(220): Zend_Db_Adapter_Pdo_Abstract->query('???????UPDATE p...', Array) #5 /home/samtqcca/public_html/stats/core/PluginsFunctions/Sql.php(68): Piwik_Db_Adapter_Pdo_Mysql->query('???????UPDATE p...', Array) #6 /home/samtqcca/public_html/stats/core/PluginsFunctions/Sql.ph in /home/samtqcca/public_html/stats/libs/Zend/Db/Statement/Pdo.php on line 234
I ran it before updating the GeoIP.php file and all past visits were updated to the correct regions / cities, but the world map wasn't updated. That's why I updated the GeoIP.php file and tried to run the geoipUpdateRows.php script again.
Any ideas?
Replying to cgray@:
I was going to post a patch, but this plugin in not in the piwik application repository. U would love to contribute...
Was this ever posted?
Or has the suggested update to the provider plugin that checks the database for organization identity from IP prior to using the gethostbyaddr() method been implemented?
GeoIP plugin still tells me Tokyo is in India...
GeoIP stopped working after update to Piwik 1.8.3. Instead of using GeoIP, Piwik started using browser language to determine users country again.
I tried to deactivate/activate GeoIP in the Plugins Management section, to reinstall the whole plugin folder from scratch nothing helps. Although it worked without any problem with Piwik 1.8.2. By the way it shows the number of version 0.17 instead of 0.18.
Can anyone help?
Hey Guys,
it's a very cool Plugin, but on PIWIK 1.8.3 it wont work. PIWIK is creating no more Stats with the Plugin activated :(
greez Manu
Hi Manu
Yes, I can confirm that. The same for me.
Best, MC
Replying to ManuelW:
Hey Guys,
it's a very cool Plugin, but on PIWIK 1.8.3 it wont work. PIWIK is creating no more Stats with the Plugin activated :(
greez Manu
Hi,
Am interested in this extension
Anybody got it working with 1.8.3 ?
Replying to panos78:
For me it works fine.
:-)
Hmm, Thats interesting...
Doesn't track anything when i enable GeoIP in 1.8.3
Have you added any hacks ?
Anybody else having issues with 1.8.3 ?
No hacks.
I don't know if it works because I have the mod_geoip active in Apache!
:)
Even with mod_geoip activated in apache2 this plugin is faulty.
I have it installed on Apache 2.2.17 and it works fine.
:-)
Suggeston to add:
$view->disableRowEvolution();
in row 51 in GeoIP/Controller.php
This will hide the Row Evolution feature on the Country and Continent table since it is currently not implemented.
Providers table will still have Row Evolution function
@mcantsin this plugin is working for me and many others, are you sure mod_geoip is active and configured?
Create a file and name it for example geoiptest.php with the following content:
<?php
header('Content-type: text/plain');
print_r($_SERVER);
?>
Then access that file via your webserver http://yourserver.com/geoiptest.php
Now you should have a couple of replies that states GEOIP information, for example:
[GEOIP_CONTINENT_CODE] => EU
[GEOIP_COUNTRY_CODE] => SE
[GEOIP_COUNTRY_NAME] => Sweden
[GEOIP_REGION] => 26
[GEOIP_REGION_NAME] => Stockholms Lan
if that is not working go to the link above http://dev.maxmind.com/geoip/mod_geoip2 and make sure the .dat file is in the right folder and readable for the webserver
Hmm, i found there is a Problem with the install process. When i run the geoipUpdateRows.php i get this error
PHP Fatal error: Uncaught exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column 'location_geoip_region' in 'field list'' in /home/www/piwik/libs/Zend/Db/Statement/Mysqli.php:77
There is a field missing and we have a php error. So nothing is logged to Piwik with GeopIP is enabled.
@greg I added the following line in GeoIP.php so it handles live visitors on my install.
Row 280
$locationInfo['region'] = (isset($_SERVER['GEOIP_REGION'])) ? $_SERVER['GEOIP_REGION'] : self::$defaultLocationInfo['region'];
@ManuelW it appears you are running the latest GeoIP without the install() function being run, I don't know how to force it to reinstall but if you know how to add SQL columns run this:
ALTER TABLE `piwik_log_visit` ADD `location_geoip_region` VARCHAR(2) NULL;
Replying to dbmz:
@greg I added the following line in GeoIP.php so it handles live visitors on my install.
Row 280$locationInfo['region'] = (isset($_SERVER['GEOIP_REGION'])) ? $_SERVER['GEOIP_REGION'] : self::$defaultLocationInfo['region'];
is it added in the new GeoIP.2.zip also?
@ManuelW it appears you are running the latest GeoIP without the install() function being run, I don't know how to force it to reinstall but if you know how to add SQL columns run this:
ALTER TABLE `piwik_log_visit` ADD `location_geoip_region` VARCHAR(2) NULL;
Thanks for the hint. Thats what i've done yesterday and would report now :D it works
Replying to ManuelW:
Replying to dbmz:
@greg I added the following line in GeoIP.php so it handles live visitors on my install.
Row 280$locationInfo['region'] = (isset($_SERVER['GEOIP_REGION'])) ? $_SERVER['GEOIP_REGION'] : self::$defaultLocationInfo['region'];
is it added in the new GeoIP.2.zip also?
Yes it is in there.
When GeoIP is enabled as an Apache module GeoIP won't work. It throws a Fatal Error like so:
PHP Fatal error: Cannot redeclare geoip_country_code_by_name() in /is/htdocs/wpxxx/xxx/piwik/plugins/GeoIP/libs/geoip.inc on line 347
My hosting provider is Hosteurope. I'm on a shared hosting there (Webpack L).
They have changed their server settings yesterday.
Hopefully there is a solution soon.
As far as I know it is not possible for apache modules to declare PHP functions. It is possible that someone at your shared host is autoloading the geoip functions, to check create a new file get_defined_functions.php with the following content
<?php
header('Content-type: text/plain');
print_r(get_defined_functions());
?>
access it via your webbrowser and search for the function there, pay extra attention to functions under the "user" tag. I'm not very familiar with autoloading functions, is piwik installed as a seperate site (VirtualHost) in your apache config?
I have a weird problem.
At the overview I see Visitors from germany, if I expand germany I see vities from Polen. The same with UK, there I see just cities from France.
I patched GeoIP plugin to fix bug in live data.
All you have to do is to find this in GeoIP.php
$mappingVisitorInfoToGeoIp = array(
'location_geoip_country' => 'country_code',
'location_geoip_continent' => 'continent',
'location_geoip_city' => 'city',
'location_geoip_latitude' => 'latitude',
'location_geoip_longitude' => 'longitude',
);
and add
'location_country' => 'country_code',
'location_continent'=> 'continent'
If you also want to modify your old data, update "updateExistingVisitsWithGeoIpData" method. Again, you only have to change Piwik_Query to
"
UPDATE ".Piwik_Common::prefixTable('log_visit')."
SET location_geoip_country = ?,
location_geoip_continent = ?,
location_geoip_city = ?,
location_geoip_latitude = ?,
location_geoip_longitude = ?,
location_country =?,
location_continent = ?
WHERE idvisit = ?",
array( $locationInfo['country_code'],
$locationInfo['continent'],
$locationInfo['city'],
$locationInfo['latitude'],
$locationInfo['longitude'],
$locationInfo['country_code'],
$locationInfo['continent'],
$row['idvisit']
And the whole thing will work :)
@dbmz
maybe Iyou're right and I was mistaken by the phpinfo() output that I got.
Maybe you'ld like to check it yourself ... they have a copy here:
[http://www.hosteurope-infos.de/phpinfo.php].
The script that you suggested outputs geoip functions in the 'internal' array like this:
[ 1278 ] => geoip_database_info
[ 1279 ] => geoip_country_code_by_name
[ 1280 ] => geoip_country_code3_by_name
[ 1281 ] => geoip_country_name_by_name
[ 1282 ] => geoip_continent_code_by_name
[ 1283 ] => geoip_org_by_name
[ 1284 ] => geoip_record_by_name
[ 1285 ] => geoip_id_by_name
[ 1286 ] => geoip_region_by_name
[ 1287 ] => geoip_isp_by_name
[ 1288 ] => geoip_db_avail
[ 1289 ] => geoip_db_get_all_info
[ 1290 ] => geoip_db_filename
[ 1291 ] => geoip_region_name_by_code
[ 1292 ] => geoip_time_zone_by_country_and_region
My piwik installation is not an extra host. it's just a site's subdirectory.
Since I have updated PIWIK to 1.8.4 I do not see any city information in the visitors log. Any idea?
Please make available a single always up-to-date zip file mortals can download and install without headaches form patches, updates, and so on :)
It would be very nice to have the main download always point to this latest release. Thank you in advance.
In the next 1.9 release, GeoIP will be included in Piwik by default. See #1823
Dear all,
I am using piwik 1.4 ,I have configured it according to my database.
As of now i get the visitor information from countries only.
I want to narrow it down to state and cities and so on....!
I followed these steps
1.Download Piwik GeoIp Plugin
2.Unzip the plugin and copy the extracted directory "GeoIp" in the directory piwik/plugins/
Configure the MaxMind database:
In my configuted piwik i am not getting any setting option and i couldnt do "Enable GeoIP plugin in Piwik. Go to Piwik > Settings > Plugins > Geoip, click Enable"
one more query
How are we using the map here??
Is it a .swf file and Js is interactig with it OR something else ??
For the GeoIp we are using .swf or someother file??
Did you install the host files ?
You can find them from Europe here
http://www.hosteurope-infos.de/phpinfo.php
Kinde regards
Gavekort
Replying to rajkisho:
Dear all,
I am using piwik 1.4 ,I have configured it according to my database.
As of now i get the visitor information from countries only.
I want to narrow it down to state and cities and so on....!I followed these steps
1.Download Piwik GeoIp Plugin
2.Unzip the plugin and copy the extracted directory "GeoIp" in the directory piwik/plugins/
Configure the MaxMind database:
- download MaxMind GeoLite City or GeoIP City database from http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz gavekort skabelon Uncompress this file and copy it in plugins/GeoIP/libs/GeoLiteCity.dat
In my configuted piwik i am not getting any setting option and i couldnt do "Enable GeoIP plugin in Piwik. Go to Piwik > Settings > Plugins > Geoip, click Enable"
one more query
How are we using the map here??
Is it a .swf file and Js is interactig with it OR something else ??For the GeoIp we are using .swf or someother file??
Thanks...I have sorted out that issue.
Next query is as follows:
When i go to ,Visitors->Locations
I see 3 colors
Red for the country having highest numberofvisits
Dark Yello for the country having second highest numberofvisits
yello for others....
I want in the Piwik files..where this color configration is done ??
After the plugin was added to the core, the old table rows can be deleted to clean the database a bit, right?
As I do not want to delete the wrong rows or just some of the rows, what exactly can I delete?
UPDATE! GeoIP Is now available as part of Piwik Core!
Ask questions in the forums: http://forum.piwik.org/
or get some Piwik Experts to help you: http://piwik.org/consulting/
What about my question from yesterday about the old table rows which can be deleted from the database?
Can I override GeoIP with custom data? For example I have an organization with many offices and subnets and I want to see those office locations in Piwik, based on my defined subnet=location data. Maxmind doesn't have these details. Or should I post this as a feature request?
You can write a custom plugin that hooks into Tracker.saveVisitorInformation, checks whether locationip is in your subnet and overrides the other location* attributes of the visitor information.
This ticket is not the right place for questions like this. If you want further free support, you can use our forums. If you want paid support (e.g. the development of such a plugin), you can contact services] or me via timo at piwik.org.