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.91k stars 2.65k forks source link

Anchor breaks goal matching #20125

Open smerriman opened 1 year ago

smerriman commented 1 year ago

I'm using Cloud-hosted Matomo, with the default Tag Manager embed.

The setting for "Page URL fragments tracking" is unchecked as per the defaults, so any fragments are removed before tracking page views. This works correctly.

However, I created a goal which fires based on an exact URL match.

It seems fragments are not removed when performing this test - meaning when I visit the URL with a fragment, it tracks a page view of the URL without the fragment, but doesn't fire a goal despite that being the URL matched.

sgiehl commented 1 year ago

Hi @smerriman, I just looked it up in the code. It is correct that goals are processed using the "raw" url sent with the tracking request. Personally I think it is fine that way, as it e.g. would allow you to track goals based on url fragments or query parameters even if those are excluded from the reports afterwards. But I guess this might be a part missing in the documentation and also in the UI as it doesn't seem to be clear it is handled that way. @mattab this might be something we should at least update in our documentation.

smerriman commented 1 year ago

Case 1: someone wants to have a goal fire when a specific URL is visited. Case 2: someone wants to have a goal fire when that URL has no fragment.

I would think Case 2 is extremely rare, and Case 1 is extremely common. So it seems very odd that in order to achieve Case 1, you have to avoid using the exact match option, and instead write a regular expression that matches the page URL.

My clients would be adding their own goals, and regular expressions are going to be tough to explain.

So whether you consider this a bug or not, it's not a good user experience at all - rather than just a documentation issue.