Problem using a comma in a Google Analytics API filter
I am having an issue with the Google Analytics Query Explorer when I try to provide a filter with a regexp that contains a comma. I 开发者_如何转开发know that commas must be escaped, but even if I add a blackslash before in the explorer, it does not work.
Example of working filter : ga:pagePath=~^/boutique-p\d{4}
Example of NOT working filter : ga:pagePath=~^/boutique-p\d{1,4}
The second example should in theory be more loose and return more results, but it doesn't.
I also tried backslash before comma, non-greedy regexp, still nothing.
Any clue ?
The documentation is still a bit confusing on the google page (after 2 years).
Your not working sample should be encoded in this way:
ga%3ApagePath%3D~%5E%2Fboutique-p%5Cd%7B1%2C4%7D
I usually use this website to figure out encoded/decoded strings:
http://meyerweb.com/eric/tools/dencoder/
Using the http://ga-dev-tools.appspot.com/explorer/
You can see how it is encoded clicking on the first icon top-left (the one with the world)
The comma is a reserved character (it is used to separate filter expressions. If you want to include it in the expression, it must be escaped with a backslash \,
per: https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters section labelled Filter Expressions - Reserved Characters
精彩评论