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

Unable to create segments for browser name if there is no browser code #20503

Open bx80 opened 1 year ago

bx80 commented 1 year ago

If a segment is created using the browser name field and the chosen browser name is not in the list of known browsers in device detector then the segment will return results for all unknown browsers rather than just the browsers matching the chosen name.

Snapchat, Google Search App and Facebook Messenger are common examples of unknown browsers/clients, but this also applies to any unrecognized browser or client.

This happens because when the segment is applied the browser name is converted into a browser code using a mapping table. As unknown browsers don’t have a browser code, this fails and the segment uses the UNK unknown browser code instead.

Expected Behavior

It should be possible to create working segment for any browser name, even if it does not have a browser code.

Steps to Reproduce

  1. Use a dataset that includes visits made with multiple browsers that are not in the list of unknown browsers (see above)
  2. Create a new segment for one of the unknown browsers: Browser > Equals > [unknown browser name, ie. snapchat]
  3. View visits for the new segment, visits for all unknown browsers will be shown.

Your Environment

Ref: L3-423

sgiehl commented 1 year ago

This is one of the "problems" we have, as we never finished implementing https://github.com/matomo-org/matomo/issues/5413 We have started to track any type of client. Before we were actually ignoring all clients except of browsers. For that we have the dimension config_client_type, which tracks the type of the client. This can be any of https://github.com/matomo-org/matomo/blob/09ff1aca8a5d82f3022bf65534a5eaf1b57ae97a/plugins/DevicesDetection/functions.php#L143-L150 All browsers tracked also have a short code assigned, which is used for tracking, but every other client type is currently tracked with it's full name. So what we actually might need to decide is, if we want to open up the browser segments to correctly match other client types or if we want to actually fix those segments to only match browsers and add new segments for e.g. clientType and clientName, to make it possible to segment correctly for any client type.