-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
BugFor errors / faults / flaws / inconsistencies etc.For errors / faults / flaws / inconsistencies etc.c: TrackingFor issues related to getting tracking data into Matomo.For issues related to getting tracking data into Matomo.
Milestone
Description
What happened?
When sending the Accept-Language HTTP header field via the "lang" parameter of the HTTP API, the country part is dropped unless it is first converted to lower case.
For example, if the value sent is en-GB,en;q=0.5
or just en-GB
then the data stored in log_visit / location_browser_lang is only en
.
If we first convert to lower case en-gb,en;q=0.5
or en-gb
then it stores en-gb
which is more useful information.
What should happen?
It should accept the input en-GB,en;q=0.5
and if it needs to be in lower case internally then the API should convert to lower case rather than discard the country part.
How can this be reproduced?
Here's an example of some API data where the problem occurs:
Array
(
[idsite] => 3
[rec] => 1
[action_name] => Page Title
[url] => http://page.url/
[_id] => ab86b7f3bf677d1c
[apiv] => 1
[urlref] => http://page.ref/
[h] => 8
[m] => 32
[s] => 44
[ua] => Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
[lang] => en-GB,en;q=0.5
[token_auth] => xxxxxxxxxxxxxxxxxxxxxxxxx
[cip] => xxx.xxx.xxx.xxx
[send_image] => 0
[res] => 2560x1440
[devicePixelRatio] => 1.5
[uid] => 1
[country] => gb // in this case we already know the country of this user, but this isn't always present
)
Matomo version
5.0.3
PHP version
8.2.16
Server operating system
Linux
What browsers are you seeing the problem on?
Not applicable (e.g. an API call etc.)
Validations
- Read our Contributing Guidelines.
- Follow our Security Policy.
- Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- The provided steps to reproduce is a minimal reproducible of the Bug.
Metadata
Metadata
Assignees
Labels
BugFor errors / faults / flaws / inconsistencies etc.For errors / faults / flaws / inconsistencies etc.c: TrackingFor issues related to getting tracking data into Matomo.For issues related to getting tracking data into Matomo.