[solved] GeoIP Problem

The GeoIP plugin is not fully integrated into Piwik. The plugin adds its own geolocated columns for its widgets, which actually overlap some in Piwik (i.e., country and continent). The existing Piwik widgets don’t use the columns added by GeoIP.

UserCountry_country_ and UserCountry_continent_ are because GeoIP returns an empty string when it can’t geolocate an IP address. Piwik expects it return ‘xx’.

These functional and integration issues will be addressed when we move GeoIP into the base distribution.

Thanks for your reply, do you already have an idea, when geoip will be integrated?
The thing I am wondering about most is, why I don’t see any cities in the locations tab, because that is why I initially installed the plugin. Even if the location would be bad I should see some cities, which might not be correct, but I should see them, right?
So what is the problem there, why don’t I get any cities in the locations tab?
Thanks a lot!

To clarify what I said, the “Locations and Provider” tab doesn’t know anything about the GeoIP columns; so, no, cities will not show up there. For now, you’ll have to look at the widgets offered by the plugin.

Sorry, I don’t have an ETA to complete the integration. Cross your fingers…maybe it’ll be in 1.2.

Okay, but if the Locations & Providers tab doesn’t know anything about it, why does it now show the GeoIP info for country and continent instead of the normal one from piwik?
In the end I just want to know how I can make piwik or the plugin show me the cities. Somehow people managed to do so, so I guess my version should be able to do it, too, but how? The only way I know to add widgets is on the dashboard, but there in the GeoIP section, only countries and continents is listed. So how do other people get to see the cities?
Thanks!

Munich, that it doesn’t work with Locations and Providers has been told right from the beginning of this thread. If you want to see cities then look at the GeoIP Visitors Countries widget. And, as I said earlier, be prepared that half of them are wrong, because country-wide providers also assign IP numbers country-wide and not regional or per city. There is no way to avoid this.

man, now I figured it out, it wasn’t an extra section in locations & providers, it was just about clicking on the country and then the cities are listed.
that was all I wanted to know, lol!

[quote=munich]
Okay, but if the Locations & Providers tab doesn’t know anything about it, why does it now show the GeoIP info for country and continent instead of the normal one from piwik?
In the end I just want to know how I can make piwik or the plugin show me the cities. Somehow people managed to do so, so I guess my version should be able to do it, too, but how? The only way I know to add widgets is on the dashboard, but there in the GeoIP section, only countries and continents is listed. So how do other people get to see the cities?
Thanks![/quote]
There may have been a misunderstanding. The Providers widget will not be able to show any GeoIP info. The widgets that say “Country (GeoIP)” etc. do show GeoIP info. What do they show for you? And they also show cities. Do you have the “Country (GeoIP)” and “Continent (GeoIP)” widgets on the “Providers and Locations” tab?

Ah, I see you figured it out while I was writing the other reply :slight_smile:

Btw, as a clarification, I do not get “UserCountry_country_” or some such, never. There is an “Unknown” then and the rate is about 2% of visitors.

[quote=munich]

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

Hi Stefan,

same here, but I fixed it.

I installed the plugin earlier and had the same problem. Basically, the geoipUpdateRows.php script will only update the first row in the piwik_log_visit table for each batch of 1000 rows fetched, leaving the other rows with all fields set to NULL. This means that if your table only has a small number of rows, < 1000 (as in my case since my Piwik install is new - I had 159 rows), then only the very first row will be updated.

When you then drop the piwik_archive* tables and regenerated the reports, you will only see wrong data, i.e. UserCountry_country_ in the countries list.

There seems to be a problem in the file GeoIP.php, in the function updateExistingVisitsWithGeoIpData().
The inner loop that updates the rows seems wrong to me.

Anyway, the quickest fix in my case, was replacing $limit = 1000; with $limit = 1;.
It processed one row per time this way, but I didn’t bother changing more the code as I only had, as said, 159 rows in that table.

Hope this helps.
Vito

Sorry to sound like a total noob here, but could you tell me how you dropped the old piwik_archive tables so that it reprocesses previous visitors? Thanks.

Uli

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.

A post was split to a new topic: GeoIP not working