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
Country is not detected with GeoIP if IP is overridden via cip
parameter
#15192
Comments
Hi there, I recommend you check if
From what I can see in the code this should work and we're actually using this in many places ourselves and don't have any issues with it. |
Hi @tsteur, thanks for your reply. Can't find "Use anonymized IP for visit enrichment" exactly but "Anonymize Visitors' IP addresses" is unchecked - is this the same? Couldn't seem to see anything similar in For the token permissions, under "API Authentication Token" I can only view or regenerate. Visits are definitely being logged though so I assume this means it has write permissions. I've updated to version 3.13 in case these settings changed names but doesn't look like it. |
This does not mean the token was write permission. You'll need to double check if the token auth is correct, and whether the user for that token has write permission (eg a super user can check this but you can also check if that user has permission to create for example Goals). |
@damianmoore Which GeoIP location provider have you configured in Matomo? |
@tsteur I can confirm the token_auth is correct and it belongs to the role for this user under "Manage Users" shows as "Super User". @sgiehl The GeoIP stuff is baked into this Dockerfile which appears to be MaxMind's GeoLite2-City. This screenshot is of the site where Matomo requests are proxied with This screenshot is of a different site where requests go directly to Matomo and countries are detected from header IP. Any other ideas for things I can check? |
@damianmoore I would recommend to maybe enable tracker logging for a short time to investigate the issue further: See https://developer.matomo.org/api-reference/tracking-api#debugging-the-tracker on how to enable tracker debug. (should be only enabled for a short time since this may be visible to your users if someone was to actually look at the response of tracking requests) |
Any update maybe @damianmoore - do you still experience the issue? |
I've just figured out what was happening when I reported this issue and now have it all working without changing my API calls to Matomo. I had wrongly thought I had Geocoding set up because I saw countries displayed for other sites I had on my Matomo installation. I hadn't realised that Matomo infers country from browser language and I was not including this header when calling the API myself. Now I have DBIP configured correctly I have countries and much more accurate city level data. |
Awesome, thanks for letting us know @damianmoore |
I have a situation where I send tracking requests from the server on behalf of user. To make sure I track the user's correct IP address rather than my own server's address, I add the
cip
parameter to the request as referred to here. I've noticed that since doing this, the user's IP addresses are not geo-coded to have a country any more and just display as 'Unknown' with a question mark.The code I am using can be viewed here. If you want a bit more background on my reasoning you can read the description of my GitHub project called Matomo Monorail.
I believe that if the
cip
parameter is included, this should be what gets fed into the GeoIP database. I have other sites tracking to the same Matomo installation via JS directly so am sure the country detection is working.I'm using Matomo version 3.12.0 from the official Docker image (matomo:3.12.0-apache).
The text was updated successfully, but these errors were encountered: