Shlink sends country names to Matomo instead of country codes, causing DB errors (CHAR(3) limit) and "Unknown" country · Issue #2391 · shlinkio/shlink · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shlink sends visit data to Matomo, but instead of sending a country code (e.g., "US" or "DE"), it sends the full country name (e.g., "United States" or "Germany"). Matomo expects a two- or three-letter country code, and since the database column for storing the country is defined as CHAR(3), the longer country names cause an error. As a result, Matomo sets the country to "Unknown".
Expected behavior
Shlink should send the country code instead of the full country name to ensure proper logging in Matomo. It already provides this from the geolocation.
Changing ->setCountry($location->countryName)
to ->setCountry($location->countryCode)
in the file module/Core/src/Matomo/MatomoVisitSender.php resolves this issue.
I'm not sure if this is the only necessary change or if other changes are required.
Minimum steps to reproduce
The text was updated successfully, but these errors were encountered:
Shlink version
4.4.5
PHP version
8.4.4
How do you serve Shlink
Docker image
Database engine
MariaDB
Database version
10.5.28
Current behavior
Shlink sends visit data to Matomo, but instead of sending a country code (e.g., "US" or "DE"), it sends the full country name (e.g., "United States" or "Germany"). Matomo expects a two- or three-letter country code, and since the database column for storing the country is defined as CHAR(3), the longer country names cause an error. As a result, Matomo sets the country to "Unknown".
Expected behavior
Shlink should send the country code instead of the full country name to ensure proper logging in Matomo. It already provides this from the geolocation.
Changing
->setCountry($location->countryName)
to
->setCountry($location->countryCode)
in the file module/Core/src/Matomo/MatomoVisitSender.php resolves this issue.
I'm not sure if this is the only necessary change or if other changes are required.
Minimum steps to reproduce
The text was updated successfully, but these errors were encountered: