matomo-org / tracker-proxy

HTTP proxy for Matomo's tracker API. This script allows to track websites with Matomo without revealing to your visitors the secret Matomo server URL.
http://matomo.org/faq/how-to/faq_132/
GNU General Public License v3.0
151 stars 46 forks source link

Emoji breaks tracking #68

Closed timoostrich closed 2 years ago

timoostrich commented 2 years ago

Hello! I am using the tracking proxy and it works fine for "normal" pages.

As soon as there is an emoji in the title the trackings breaks and matomo.php returns a 400 status. I am using matomo 4.10.0, PHP 8.0.16 and the DB charset is UTF8mb4.

Any ideas how I can get it to work with emojis in titles?

matomo-emoji-400-02 matomo-emoji-400

sgiehl commented 2 years ago

Hi @timoostrich Sorry to hear you are having trouble with your tracking. Are you able to see any additional details in the log files of your webserver or matomo itself? If not you can try to turn on the debugging for tracking requests and see if the logs for such a tracking request contain some information that points to the problem.

timoostrich commented 2 years ago

Hi @timoostrich Sorry to hear you are having trouble with your tracking. Are you able to see any additional details in the log files of your webserver or matomo itself? If not you can try to turn on the debugging for tracking requests and see if the logs for such a tracking request contain some information that points to the problem.

Hi @sgiehl thanks for taking the time!

In debug mode there is no response, too (400). When I remove the emoji from the URL everything works fine and the debug mode shows all its information.

When I remove the "action_name" parameter completely (which includes the emoji) everything works fine, too.

image

sgiehl commented 2 years ago

Are you able to see any errors in the log file of your webserver? Just wondering if the request actually reaches Matomo or if it might be blocked by the webserver for any reason. Could you maybe try to send the same request, but rename the action_name parameter name to something random. That way the parameter should be ignored, but the request should still be tracked.

timoostrich commented 2 years ago

Okay I just checked different things:

  1. In the log of my tracked page I can see the bad try of the post request to matomo and the status 400
  2. In the log of my webspace where matomo is hosted I can't see the request
  3. But: changing "action_name" content to something else ("TESTING") worked - it showed up in my matomo.
  4. Surprising: Some emojis seem to work, for example the heart (❤️), others like the color palette do not (🎨).

So it looks like the tracking proxy has problems with some emojis?

sgiehl commented 2 years ago

Just did some local testing, and Matomo is able to track 🎨. So it might be an issue of the tracker proxy. Unfortunately I don't have enough time at the moment to check this in details. If you are able to track down the problem yourself, feel free to create a pull request if changes are required to fix it.

timoostrich commented 2 years ago

I was not able to get it working so I tried a fresh installation of matomo and that works without any problems for all kind of emojis. I have no idea what's wrong with the old installation.