Open dandv opened 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.
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?
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.
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
@mattab, see @sgiehl's comment above.
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)
Suggested fix:
In other words: when user forgets to remove enclosing double quotes, we do it for her
@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?
as mentioned in #8050 useragents might contain quotes, so simply removing them is not accurate
we should remove the enclosing quotes only, eg. using the second parameter of PHP trim function
PR in #8586
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?
Edit see also https://github.com/matomo-org/matomo/issues/14880
I had configured the following string under the Websites -> Global list of user agents to exclude:
It belongs to the Monitor.us service.
Yet later I still saw that bot in the Real-time Visitors:
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?