Matomo On-Premise Geolocation issue

Am using matomo onpremise version 4.1.0. Before Geolocation setup it was showing all the users from United States in the Location tab under Visitors. After a period of time i have done setup of DBIP/GeoIP 2 (Php ) in Geolocation but still in the new data tracked after setup is done it is showing most of the user from United States and only 1-2 users from Netherlands. Ideally it should show all the Users from Netherlands.

  1. What can be the reason ? Is it still mapping the old users to old location and only new users are correctly mapped ?
  2. I also tried "php ./console usercountry:attribute 2012-01-01,2013-01-01"in the cmd but am getting error as “Could not open input file: ./console”. I also tried “C:\Program Files (x86)\PHP\v8.0>php ./console usercountry:attribute 2012-01-01,2013-01-01
    Could not open input file: ./console” but same error.

Any help will be greatly appreciated.

Regards,
Paresh Badgujar

Hi,

Can you check if the IP addresses of the users are really their IP addresses and not the IP address of a reverse proxy in front of the webserver?

This is unrelated, but the command assumes you are currently in the Matomo directory. Otherwise you need to use /the/path/to/matomo/console instead.

Hi Lukas,

Thanks for your prompt reply

We are using the reverse proxy in front of the webserver

Then this guide might help:
https://matomo.org/faq/how-to-install/faq_98/

I have same kind of issue with newly installed Matomo. I installed DBIP / GeoIP 2 (Php) and then I also installed IP2Location and downloaded the database and installed it. System gives no error messages.

But both geolocation solutions give me wrong answers. They give me wrong locations, suggesting that I am in Amsterdam (Netherlands), although I am in Finland.

The https://www.ip2location.com/demo/ website finds my correct location precisely.

I have enabled IP anonymisation, but that should not be a problem in Matomo.

What is the problem?

@Aarne Is your Matomo server behind a proxy? Is it on an Intranet?
Check on the visits logs if IPs are the ones from Finland…

This is strange. Matomo with geolocation gives me IP: 141.101.0.0 when I visit my website either with mobile phone or with computer browser. Website is on-premises with Finnish server provider Wepardi https://www.wepardi.fi
My laptop is in ethernet connection to wired cable modem with telecom operator. My mobile phone in in WiFi connection to the same cable modem.
When I check MyIP directly with browser I get it right. But Matomo gives me IP: 141.101.0.0 which is probably Mykolaiv, Lviv Oblast, Ukraine, but Matomo says it is Netherlands!
What is this?

Because of your configuration, Matomo doesn’t tell you the full IP address:

Maybe the proxy (whose address starts with 141.101.0.0) is located in Netherlands?

I don’t have any proxy as far as I know.
I have enabled 2 byte anonymisation but Matomo instructions says: " If you enable IP anonymisation (which is the default in Matomo), then by default Matomo will not store the full IP address in the database, but it will still use the full IP address to get the geo-location information (for better accuracy).

Temporarily you can disable the IP anonymization…

I disabled IP anonymization. But the Visit Log result is the same. It says I am in Netherlands. And when I check that IP on another service it says Amsterdam.
But I am really in Tampere, Finland!

It seems the service you use to host Matomo uses a proxy located in Netherlands.
I think you should contact their support to know how to configure the proxy properly, thanks to guide provided by Lukas:

Thank you for your help. I couldn’t guess that my web hosting service is in fact using Cloudflare reverse proxy. I just found it out when I called them. Now they took my website out of the proxy. It should be effective within 24 hours.
But I wish Matomo had a plugin for that kind of proxy situations. I have read the guide “How do I configure Piwik when the server is installed behind a proxy?” But you need quite a lot of info to work it out. When I called to my web hosting service advicer he had to ask his colleague what kind of proxy they have. And still I don’t know if “Matomo is connecting through a reverse proxy” or " If I have installed Matomo from behind the reverse proxy".

I withdraw the request to take our site out of the proxy. Instead I checked that it is behind the reverse proxy and then I proceeded according to configuration guide and finally Matomo with IP2Location is working like it should!