Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoIP location not working correctly since Matomo 4.0.0 #16964

Closed
robles-design opened this issue Dec 15, 2020 · 10 comments
Closed

GeoIP location not working correctly since Matomo 4.0.0 #16964

robles-design opened this issue Dec 15, 2020 · 10 comments

Comments

@robles-design
Copy link

robles-design commented Dec 15, 2020

I used the HTTP server modul on a hosted server until Matomo 4.0.0. After upgrading to 4.0.0 that doesn't work anymore and I installed the DBIP City Lite database. In the administration settings my location Siegen is recognized correctly (see screenshot), but if I go to Visitors > Cities there are no new entries for Siegen. I have tested it and the city shows up in the real time logs as Frankfurt am Main. Any idea?

matomo-geoip2

matomo-geoip2-siegen

@sgiehl
Copy link
Member

sgiehl commented Dec 16, 2020

I think this might actually the same as #16714 (comment)
@robles-design could you check if the city is in the list without a region name maybe?

@robles-design
Copy link
Author

Yes the city is in the list without a region name, but only 3 times since Matomo 4.x.x. That must be more. And why is it displayed in the admin menu correctly (see screenshot in my first post) but counted as a wrong city (Frankfurt am Main) in the visitor log? Frankfurt am Main gets more counts than they really have and Siegen gets less in that case. And I think this will happen to many more cities.

matomo-geoip2-location-siegen

@sgiehl
Copy link
Member

sgiehl commented Dec 16, 2020

@robles-design As you might have seen in the linked comment. Db-IP doesn't report region ISO codes in the free version, so we are trying to map the names to iso codes. But as your screenshot show DB-IP reports the name in english, so it can't be mapped to the ISO code, as the official ISO name is in German.
But the main difference is the GeoIP database you are using. DB-IP and Maxmind are having differences in the detection. So it might be possible that DB-IP reports another location. You could sign up at Maxmind and use their free database instead. That might solve your problem maybe.

@robles-design
Copy link
Author

@sgiehl I understand that it can't be mapped to the ISO code. What I don't understand is why my visit from the city Siegen (reported by the location test in the admin panel) is shown as a visit from the city Frankfurt am Main in the dashboard and visitors log. If it can't be mapped it shouldn't be counted as a wrong city in my opinion.

I found a solution for my case. As I mentioned I used the server module on a hosted server and wondered why it didn't work after updating to 4.0.0. Matomo told me that it is not installed and I thought the previous working server module is too old and needs to be updated to work again with the new Matomo version. But without server access I can't update it and installed DB-IP. Cause the server module is faster and I'm not happy with the actual location results I tried it again and got it working. All I had to do was changing the variables in the Matomo settings from MM_XXX_XXX to GEOIP_XXX_XXX ;-)

Thanks for your support,
Robert

@sgiehl
Copy link
Member

sgiehl commented Dec 17, 2020

@robles-design If you used the same IP for being tracked and the admin UI the location should actually be the same. Unless there is some kind of proxy in front of Matomo, that sends another IP or something like this.

Regarding changing the variables. That should work, as long as the data stored in those variables is actually GeoIP2 data.
Maxminds' GeoIP used FIPS codes for regions, which do not match the ISO region codes GeoIP2 is using. So if you variables are filled with GeoIP data, the tracked regions might be incorrect or missing

@robles-design
Copy link
Author

@sgiehl Yes, same IP and no proxy results in different cities in the admin UI and the Matomo stats. That's what I tried to say from the beginning. For me the HTTP server module is working now. If you need more information about DB-IP I can reactivate it for testing purposes.

@sgiehl
Copy link
Member

sgiehl commented Dec 17, 2020

@robles-design Do you have IP Anonymisation enabled? If so did you enable using the full ip for enrichment of visitor data? If not the tracking might use the anonymized IP for Geo IP lookup...

@robles-design
Copy link
Author

@sgiehl Yes it's enabled, but with the HTTP server module and in the admin UI it shows the right city with DP-IP also..

@sgiehl
Copy link
Member

sgiehl commented Dec 17, 2020

The server module always uses the original IP I guess, at least that is not controlled by Matomo as the data is provided by the webserver.
The admin UI is meant as demo and therefor uses the IP in request headers.

The tracking does not directly use the IP from header. If IP anonymization is enabled it might be anonymized before it's passed to the GeoIP database for detection unless using the anonyimized IP for enriching visitor data is disabled.

@robles-design
Copy link
Author

Ok, that makes sense. Maybe a hint in the admin location settings would be good for the users. Something like "DB-IP (and Maxmind?) will not work accurate if IP anonymization is enabled." I think users would benefit from that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants