@dandv opened this Issue on May 23rd 2015 Contributor

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 on May 24th 2015 Member

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 on May 24th 2015 Owner

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 on May 24th 2015 Contributor

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 on May 24th 2015 Owner

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 on May 24th 2015 Contributor

@mattab, see @sgiehl's comment above.

@saleemkce commented on June 6th 2015 Contributor

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 on July 15th 2015 Owner

Suggested fix:

  • when user inputs a user agent with double quotes, we remove the enclosing double quotes (+ trim) before testing against the visitor user agent

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

@saleemkce commented on July 15th 2015 Contributor

@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 on July 15th 2015 Member

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

@mattab commented on July 15th 2015 Owner

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

@mnapoli commented on July 28th 2015 Member

PR in #8586

@tsteur commented on August 29th 2015 Owner

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?

Powered by GitHub Issue Mirror