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

When tracking with `data-track-content`, the `data-content-piece` (and `-name`?) value receives HTML entities encoding twice. #20520

Open LeoniePhiline opened 1 year ago

LeoniePhiline commented 1 year ago

Context

Tracking content by annotating it with data-track-content, data-content-name, data-content-piece and optionally data-content-target.

This is about data-content-piece values containing & in the HTML source code on the webpage.

Screenshot_20230324_234408 (Chrome View Source)

Expected Behavior

In the matomo visitor live view, I expect to see &.

Current Behavior

In the matomo visitor live view, I actually see &.

Screenshot_20230324_234343 (Live visitor profile)

Note: data-content-name might be affected as well.

Possible Solution

The value appears to be sent correctly (as %26):

Screenshot_20230324_234945 (Chrome network panel, POST payload source)

This means that it's only a matomo server-side UI problem, not a data-capture browser-side problem.

Steps to Reproduce (for Bugs)

  1. Have a webpage using matomo
  2. Annotate content with data-track-content, data-content-name and data-content-piece .
  3. Use a string containing & (encoded as &).
  4. Visit the page.
  5. Observe the visitor log.
  6. See & where you would expect &.

Your Environment

Matomo-Version: 4.14.1 MySQL-Version: 10.6.12-MariaDB-1:10.6.12+maria~deb10 PHP-Version: 8.1.17

bx80 commented 1 year ago

Thanks for reporting this @LeoniePhiline :+1:

I've been able to recreate the problem and it does look like a UI encoding issue in Matomo, I'll assign this issue for prioritization.