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

Excluded User Agent still tracked #7978

Open dandv opened 9 years ago

dandv commented 9 years ago

I had configured the following string under the Websites -> Global list of user agents to exclude:

"Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0"

image

It belongs to the Monitor.us service.

Yet later I still saw that bot in the Real-time Visitors:

image

Do I maybe need to add the user agent string without quotes? By the way, there's no explanation of the format in which UA strings should be entered in that box. Presumably, one per line, but who knows? CSV format? Quoted or not?

sgiehl commented 9 years ago

Looking at the code it seems to be a unquoted comma separated list. But that might not be that good at all, as some useragents might also contain a comma. Nevertheless it should be explained which format is used.

mattab commented 9 years ago

Do I maybe need to add the user agent string without quotes?

Yes you need to set the user agent without quote. Does it work for you after removing the double quotes?

dandv commented 9 years ago

IMO it would be most intuitive and easiest to paste user agents one per line, and have Piwik automatically take care of enclosing double quotes. These are the two ways users will find the UA strings, from various sites (without quotes), or from server logs (with quotes).

Comma-separate adds unnecessary complexity and potential for breakage if comas aren't escaped correctly.

mattab commented 9 years ago

Actually the textarea field should accept one user agent per line, not comma separated. If one user agent per line does not work, please let us know, it's a bug we would fix ASAP

dandv commented 9 years ago

@mattab, see @sgiehl's comment above.

saleemkce commented 9 years ago

IMO it would be most intuitive and easiest to paste user agents one per line, and have Piwik automatically take care of enclosing double quotes.

  • This has been fixed. Fix will take care of quotes if present

Actually the textarea field should accept one user agent per line, not comma separated. If one user agent per line does not work, please let us know, it's a bug we would fix ASAP

  • I tested this scenario extensively with 4 different browsers (IE, Chrome, FF & Opera)/Windows OS today. I didn't face any incorrect tracking. But when quotes were present before the commit I made, it failed to work correctly.
  • Tested browsers in my system
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1 (Ubuntu browser just for testing)
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML like Gecko) Chrome/43.0.2357.81 Safari/537.36 (Chrome)
Mozilla/5.0 (Windows NT 6.1; rv:35.0) Gecko/20100101 Firefox/35.0 (Mozilla)
Opera/9.80 (Windows NT 6.1; U; en) Presto/2.10.229 Version/11.61 (Opera)
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)  (IE)
mattab commented 9 years ago

Suggested fix:

In other words: when user forgets to remove enclosing double quotes, we do it for her

saleemkce commented 9 years ago

@mattab The fix I posted handles the "remove the enclosing double quotes" part. And the function checkAndReturnCommaSeparatedStringList already does the "(+ trim)" part. So, could you suggest what else we should consider or is the current fix sufficient?

sgiehl commented 9 years ago

as mentioned in #8050 useragents might contain quotes, so simply removing them is not accurate

mattab commented 9 years ago

we should remove the enclosing quotes only, eg. using the second parameter of PHP trim function

mnapoli commented 9 years ago

PR in #8586

tsteur commented 9 years ago

There is a PR for that but it's targeting 3.0 . Can we maybe move this issue out of 2.15 into 3.0? Maybe a solution that is ok for now would be to just mention in the inline help to not put them into quotes?

mattab commented 5 years ago

Edit see also https://github.com/matomo-org/matomo/issues/14880