[solved] GeoIP Problem

Hi guys,
I installed the GeoIP plugin in my Piwik 1.1.1 as described in Plugin using GeoIP to accurately detect visitor countries, cities, and continent · Issue #5465 · matomo-org/matomo · GitHub

I could not perform this part, since I don’t have control over the server:
For more performance, it is recommanded to install the module apache mod_geoip. Configure your Apache according to: GeoIP Legacy Apache Module « MaxMind Developer Site

I also performed the actions to update the old reports.

The problem now is that basically not much changed. The dashboard looks just the same, and when I click on Visitors -> Locations & Provider, I still get the normal provider information, but in the country part it just says UserCountry_country_ and in the continent section it says UserCountry_continent_.
There is no section for the cities.

There were no errors during the installation, so I think basically everything went fine. I activated the option to mask the IP by setting the last 3 digits of every IP to 0 to comply to German law, could that be a part of the problem?

I hope you can help me with this!
Thanks a lot in advance!
munich

Im new to Piwik and this this is the same problem I been having. Been searching around for the answer didn’t come up with anything.

Please help.
Thanks

Can no one help me with this?
Thanks!

if the geoip update script doesn’t do it, You have to drop/truncate the archive tables, so that they get regenerated.

I already did that, didn’t help. There are no cities shown in Locations & Provider and the countries there differ a lot from those shown on the dashboard.
Any other ideas?
Thanks!

Use GeoIP / Visitor countries widget.

Where? On the dashboard?
Actually I think here the normal piwik country detection is more reliable, since GeoIP shows me that I have people from really weird countries, I don’t trust that. And how do I get the city detection?
Is it a problem, if I use the ip masking?

Do you have a contract with Maxmind? If not GeoIP is GeoIP light and that does contain less granular and accurate data than the subscribed version. It does contain cities, but not always and not for all countries, for some it even contains “sub-cities”, and you see them when clicking the country. However, keep in mind that city cannot be accurate. Most people nowadays use a provider that is operating per country or even world-wide. In many cases the location information attached to the IP numbers in AS and other whois records is wrong or outdated or is simply the location of the provider. There is nothing that can be done about this.
My GeoIP data seems to be quite correct. Unfortunately, there doesn’t seem to be a way to see the IP number, so you cannot check the correctness.
I don’t know if IP masking is a problem. Theoretically not. It doesn’t matter which IP number is looked up for a /24 subnet, you will always get the same location.

hostip.info is an attempt to geolocate at the city level (using /24 blocks). However, it relies on ISP and user-submitted data. and it appears the data appears to expire after some time (if not refreshed/updated). Would there be any interest in having that as an alternate option to Maxmind’s GeoIP?

I’m simply using http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz as recommended here Plugin using GeoIP to accurately detect visitor countries, cities, and continent · Issue #5465 · matomo-org/matomo · GitHub. Is there something better?
As I wrote sometimes the countries are even not detected at all… very weird. Do you know something else, where I could ask for help?
Thanks!

It is normal that not all countries can get detected. Also, you have to regularly update the database (monthly). Do you do that?

http://geolite.

See, the “geolite” ? If youw ant to know more, start here: http://www.maxmind.com/app/ip-location

I just installed the plugin a few days ago and also the database is from that day, so it should be up to date, I guess.
Any other ideas?
Thanks!

Honestly, you do not know at all that your data is not correct. I would first check that, before I cry wolf.

So, why does it locate my visits in the US, when I am in Germany? Why are many user countries listed as UserCountry_country_? Why do I suddenl have visitors from all over the world on a german website, if I haven’t had visitors from all these countries before according to the normal piwik location?
Don’t you think this is enaugh to think the data might perhaps not be right?

It looks like you haven’t set it up right. It doesn’t look at the moment like there is a problem with the data itself. Do you get the same UserCountry_country_ stuff if you reduce the report time to just today? I mean it is possible that all your old data that doesn’t have GeoIP data associated could be showing that (just an assumption). If that is not the case, then you likely have done something wrong during setup.

Yes, it’s also todays data. I mean there is not much you can do wrong in the setup, what do you think?
I just was not able to do the part

For more performance, it is recommanded to install the module apache mod_geoip. Configure your Apache according to: http://www.maxmind.com/app/mod_geoip

from the installation instructions on http://dev.piwik.org/trac/ticket/45.
But regarding the rest I did not see any problems.
Is there a way I can uninstall the plugin again and reinstall it then, maybe it will work properly then?
Thanks!

That module is really optional. I think you can disable the plugin, uninstall has to be done manually, probably. I can’t really tell you what’s wrong with your GeoIP setup, but it is apparent that something is wrong. The problem is likely not in the plugin files you installed, but in the path to the GeoIP data or some restriction/limit, so that the lookups don’t work correctly. Maybe it’s some missing permission or another restriction. Frankly, I wouldn’t run Piwik on a shared server. I would have a close look at the php error log. You can also check yourself with a small php script if the data retrieval and content from the GeoIP database works correctly.

Well, unfortunately I don’t have my own server.
I can’t really imagine a problem with the path, what do you mean with that?

This is all speculation. You have to walk thru the install instructions and make sure you followed them to the minute. I used them about a year ago or so and it worked fine from the beginning.
Then you could use a php script and check if the GeoIP lookup works better with it.

Okay, I am installing another Piwik on my webspace now and report every step here:

[ul]
[li] Downloaded the last Version 1.1.1 of Piwik
[/li][li] Opened the installation instructions on Installing Piwik - Analytics Platform - Matomo
[/li][li] Switched FTP Client to binary mode and uploaded the files without any problems
[/li][li] Opened the directory in the browser, welcome screen appeares
[/li][li] System check: No errors, one warning (Memory limit 64M. On a high traffic website, the archiving process may require more memory than currently allowed. If necessary, change the memory_limit directive in your php.ini file.) Should not be a problem for me, I don’t have so much traffic, I think.
[/li][li] Database setup: changed 127.0.0.1 to localhost and entered database name, pwd, … Go -> Tables created with success!
[/li][li] General Setup (entering superuser data) Go -> Success
[/li][li] Set up a website (entering the data of my website) -> No problems, I get the javascript code
[/li][li] Congratulations! Your Piwik installation is complete.
[/li][/ul]

Okay, I guess Piwik has been installed perfectly now!

I then inserted the code in my website.

Piwik locates me in the US, weird thing, since I am in Germany… I was in the US with my computer last year and my OS is in English, but how can that be?

Now I want to install the GeoIP Plugin:

[ul]
[li] I go to Plugin using GeoIP to accurately detect visitor countries, cities, and continent · Issue #5465 · matomo-org/matomo · GitHub and download the Piwik GeoIP Plugin.
[/li][li] Extract it and upload the extracted folder in the plugin directory, no problems.
[/li][li] I download the GeoLite City database from http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
[/li][li] Extract it and load it to plugins/GeoIP/libs/GeoLiteCity.dat
[/li][li] The filesize on the server matches exactly the one on my harddisk, seems like a successfull upload.
[/li][li] I ignore the part “For more performance, it is recommanded to install the module apache mod_geoip. Configure your Apache according to: GeoIP Legacy Apache Module « MaxMind Developer Site” of the installation instructions, since I don’t have full access to the server.
[/li][li] I enable the Plugin in the Piwik settings…
[/li][/ul]

What happens now after the activation:
I see the page:


Database Upgrade Required

Your Piwik database is out-of-date, and must be upgraded before you can continue.

The following plugins will be updated: GeoIP.

Important note for large Piwik installations

    * If you have a large Piwik database, updates might take too long to run in the browser. In this situation, you can execute the updates from your command line:
      php /webspace/10/53299/statistics.good4media.de/index.php -- "module=CoreUpdater"
    * If you are not able to use the command line updater and if Piwik fails to upgrade (due to a timeout of the database, a browser timeout, or any other issue), you could manually execute the SQL queries to update Piwik.
      › Click here to view and copy the list of SQL queries that will get executed

      # Note: if you manually execute these queries, it is expected that some of them fail. In this case, simply ignore the errors, and run the next ones in the list.

         UPDATE piwik_option SET option_value = "0.9" WHERE option_name = "version_GeoIP";


and click on Upgrade Piwik.

-> Piwik has been successfully updated!

I go back to Piwik as the page tells me to.

Now I want to update my past reports:

[ul]
[li] I run the file /plugins/GeoIP/misc/geoipUpdateRows.php in my browser.
[/li][li] Here I get the warning:
[/li]Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode in /plugins/GeoIP/misc/geoipUpdateRows.php on line 17
[li] Maybe this was the problem before?
[/li][li] I edit the file and delete the line

set_time_limit(0);

. I upload the edited file and execute it again.
[/li][li] I see a blank page, hmm, at least no errors.
[/li][li] I drop the tables piwik_archive_blob_2011_01 and piwik_archive_numeric_2011_01
[/li][li] Half the visitors in Locations & Provider are listed as UserCountry_country_ the other half is from Germany as expected. In the continent section half Europe, half UserCountry_continent_. Also the providers are listed.
[/li][li] Still no cities listed here, nope, none at all. They should be in the Locations & Provider section, right?
[/li][li] The question is: What is the problem now? Why are no cities listed and why are many countries not detected at all?
[/li][/ul]

I hope you can help me to fix these problems with this detailed report.
I saw that the current version of CityLite Geo is from January 1st, 2010, could that be a reason for the problems? A new version will be available on February 1st, 2011, so I will see that soon.
I don’t understand, why no cities are shown at all! If the cities were wrong I would understand it, but that they are not shown at all? That seems to have something to do with Piwik…

When I tryed to locate my self via Your IP Address's GeoIP2 Data | MaxMind I was located in a neighbouring city. Okay, that would be fine.

I hope you can help me to fix the problem with this new info.
Thanks,
Stefan