matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.71k stars 2.62k forks source link

Default GeoLocation via language is not working. #7632

Closed d4rken closed 9 years ago

d4rken commented 9 years ago

I'm using the Android-SDK to send queries to Piwik.

I can see that query from Android contains the correct paramters:

country=US&lang=en

The language is also displayed in the Piwik "Location" tab, but it still says I'm located in Germany, which I am, but it should place me in the USA?

I'm using Piwik 2.12.1

Another test:

country=NL&lang=nl

Still places me in Germany instead of the Netherlands.

mattab commented 9 years ago

Hi @d4rken

Thanks for the report. Setting country=us does not currently work for you because this API parameter requires you to set token_auth (see doc)

To solve this issue, maybe we could simply make country/region/lat/long/city API parameter not require anymore token_auth to be set. This would make sense as part of our previous work in #6109 #6407 and #6110

d4rken commented 9 years ago

@mattab Could you please change the documentation? edit: Or point me where i could change it, if below assumption are correct.

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.

http://developer.piwik.org/api-reference/tracking-api Other parameters (require authentication via token_auth) An override value for the country. Should be set to the two letter country code of the visitor (lowercase), eg fr, de, us.

^ No mention of GeoLocation

An override value for the Accept-Language HTTP header field. This value is used to detect the visitor's country if GeoIP is not enabled.

^ Language doesn't state to require a token.

Nowhere does it state that the country parameter is used to determine the location (although somewhat expectable), it says everywhere it's based on the language and that doesn't require an api token. API DOCs & Piwik GeoLocation settings say that.

Regarding your suggestion: My first thought was that this makes it open for abuse. People could set random values. But is this really an issue, let's say people are abusing it and the dev notices, when then GeoLocation is changed to a different type, is that then overriding the country parameter in the Piwik console?

mattab commented 9 years ago

Alright I re-read better and of course there is a bug, that the lang parameter doesn't seem to be used by the fallback location provider. we will investigate this