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 2 doesn’t show visitors data #14691

Closed
DenisVS opened this issue Jul 23, 2019 · 12 comments
Closed

GeoIP 2 doesn’t show visitors data #14691

DenisVS opened this issue Jul 23, 2019 · 12 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@DenisVS
Copy link

DenisVS commented Jul 23, 2019

This is a copy of my issue from the official forum, because there are still no answers.
https://forum.matomo.org/t/geoip-2-doesnt-show-visitors-data/33452
After setting up, my server provides the necessary HTTP headers:

["HTTP_X_REAL_IP"]=>
  string(12) "51.15.106.67"
  ["HTTP_GEOIP2_AUTONOMOUS_SYSTEM_NUMBER"]=>
  string(5) "12876"
  ["HTTP_GEOIP2_AUTONOMOUS_SYSTEM_ORGANIZATION"]=>
  string(13) "Online S.a.s."
  ["HTTP_GEOIP2_CONTINENT_CODE"]=>
  string(2) "EU"
  ["HTTP_GEOIP2_CONTINENT_GEONAME_ID"]=>
  string(7) "6255148"
  ["HTTP_GEOIP2_CONTINENT_NAMES"]=>
  string(6) "Europe"
  ["HTTP_GEOIP2_COUNTRY_GEONAME_ID"]=>
  string(7) "2750405"
  ["HTTP_GEOIP2_COUNTRY_ISO_CODE"]=>
  string(2) "NL"
  ["HTTP_GEOIP2_COUNTRY_NAMES"]=>
  string(11) "Netherlands"
  ["HTTP_GEOIP2_LOCATION_ACCURACY_RADIUS"]=>
  string(3) "500"
  ["HTTP_GEOIP2_LOCATION_LATITUDE"]=>
  string(8) "52.38240"
  ["HTTP_GEOIP2_LOCATION_LONGITUDE"]=>
  string(7) "4.89950"
  ["HTTP_GEOIP2_LOCATION_TIME_ZONE"]=>
  string(16) "Europe/Amsterdam"
  ["HTTP_GEOIP2_REGISTERED_COUNTRY_GEONAME_ID"]=>
  string(7) "2750405"
  ["HTTP_GEOIP2_REGISTERED_COUNTRY_ISO_CODE"]=>
  string(2) "NL"
  ["HTTP_GEOIP2_REGISTERED_COUNTRY_NAMES"]=>
  string(11) "Netherlands"

My configuration for server variables is remapped appropriately:

HTTP_GEOIP2_CONTINENT_CODE	 Default: MM_CONTINENT_CODE 
HTTP_GEOIP2_CONTINENT_NAMES	 Default: MM_CONTINENT_NAME 
HTTP_GEOIP2_COUNTRY_ISO_CODE	 Default: MM_COUNTRY_CODE 
HTTP_GEOIP2_COUNTRY_NAMES	 Default: MM_COUNTRY_NAME 
HTTP_GEOIP2_LOCATION_LATITUDE	 Default: MM_LATITUDE 
HTTP_GEOIP2_LOCATION_LONGITUDE	 Default: MM_LONGITUDE 
HTTP_GEOIP2_POSTAL_CODE	 Default: MM_POSTAL_CODE 
HTTP_GEOIP2_CITY_NAMES	 Default: MM_CITY_NAME 
HTTP_GEOIP2_AUTONOMOUS_SYSTEM_NUMBER	 Default: MM_ISP 
HTTP_GEOIP2_AUTONOMOUS_SYSTEM_ORGANIZATION		 Default: MM_ORG 

cd1a51e9848c3ab61910a5dfaeab88b92d154adf
But all information about users in real-time section is the IP and location based on browser language settings.
When I run test in console it give something like:

> php /path/to/my/site/piwik/console diagnostics:run
Geolocation: WARNING The default location provider guesses a visitor's country based on the language they use. This is not very accurate, so we recommend installing and using GeoIP.
1 warnings detected

What’s wrong?

@tsteur
Copy link
Member

tsteur commented Jul 23, 2019

The command line might be wrong since apache wouldn't set the headers there. I suppose you can ignore it and rely on the UI which tells you that GeoIP2 Apache is being used.

It seems otherwise like some server setup issue which we can't provide support here in the issue tracker unfortunately as this is quite server specific.

In the screen you posted it looks like generally the location is being detected? It shows the right ORG etc. which it wouldn't be able to detect from the language provider.

@DenisVS
Copy link
Author

DenisVS commented Jul 24, 2019

Well, I created the headers in accordance with the requested by UI. It gets exactly what it wants.
I'm trying to make what can be detected anyway.
What should I do, what conditions should I provide besides those headers?

@tsteur
Copy link
Member

tsteur commented Jul 24, 2019

I'm trying to make what can be detected anyway.
What should I do, what conditions should I provide besides those headers?

Sorry I'm not quite 100% sure what you mean?

@DenisVS
Copy link
Author

DenisVS commented Jul 24, 2019

I just want it to correctly determine geodata.
And I can alter the http headers of server to some extent for it.

@tsteur
Copy link
Member

tsteur commented Jul 24, 2019

Sorry I'm still not understanding what you mean? In the UI it looks like things are already working and you correctly determine geodata? @sgiehl do you maybe know more here?

@DenisVS
Copy link
Author

DenisVS commented Jul 25, 2019

Visibility of the correct data only on the settings page.
It seems that in the log geodata represents "as is".
Clipboard Image (25 July 2019)

@sgiehl
Copy link
Member

sgiehl commented Jul 25, 2019

@DenisVS are you using JS tracking or log import?

@DenisVS
Copy link
Author

DenisVS commented Jul 25, 2019

JS via tracker-proxy

@sgiehl
Copy link
Member

sgiehl commented Jul 25, 2019

That might possibly the issue. Haven't had a closer look at the proxy script. But apache sets the variables based on the IP of the request. Which would be the one of the server when the request is proxied with curl. The correct IP is send with the tracking data, so it's displayed correctly in Matomo, but Apache doesn't see it and can't locate the IP correctly.
Maybe the proxy script needs to be adjusted, so the IP is sent as "X-Forwarded-For" Header or similar with curl, so you can configure Apache to use that if available.

@tsteur
Copy link
Member

tsteur commented Jul 25, 2019

It's already doing this maybe @sgiehl https://github.com/matomo-org/tracker-proxy/blob/master/proxy.php#L192-L196 ?

Seems like we can close the issue and @DenisVS would maybe need to configure to use the correct IP in apache?

@sgiehl
Copy link
Member

sgiehl commented Jul 26, 2019

@tsteur that is only used to determine the IP that is sent as cip in the tracking request. The curl request in https://github.com/matomo-org/tracker-proxy/blob/master/proxy.php#L304-L334 is send with the server ip address and doesn't have a additional "X-Forwarded-For" Header or similar

@tsteur
Copy link
Member

tsteur commented Jul 28, 2019

Thanks, created matomo-org/tracker-proxy#51

@tsteur tsteur closed this as completed Jul 28, 2019
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants