andeedee / gapi-google-analytics-php-interface

Automatically exported from code.google.com/p/gapi-google-analytics-php-interface
0 stars 0 forks source link

processFilter doesn't allow metrics/dimension with numbers #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Goal metrics (e.g. goal1Completions) will not match the regex and therefore
are not prepended with "ga:" in the processFilter() function.

Original issue reported on code.google.com by jasonw...@gmail.com on 13 Jul 2009 at 5:24

GoogleCodeExporter commented 9 years ago
Hi Jasonwtan,

Can you please provide more information, specifically an example of the filter 
string
you are using here.

Thanks,
Stig

Original comment by stigmann...@gmail.com on 13 Jul 2009 at 9:50

GoogleCodeExporter commented 9 years ago
An example filter string that doesn't work is "goal1Completions>0"

The second preg_replace in processFilter() should use the range [a-z0-9] 
instead of
just [a-z].

Original comment by jasonw...@gmail.com on 13 Jul 2009 at 11:25

GoogleCodeExporter commented 9 years ago
Hi Jasonwtan,

Thanks for the bug-fix. 

As you suggest, the second block to match the dimension/metric should be a-z0-9:

$filter = preg_replace('/(&&\s*|\|\|\s*|^)([a-z0-9]+)(\s*' . $valid_operators .
')/i','$1ga:$2$3',$filter); //Prefix ga: to metrics and dimensions

This fix will be included in version 1.4.

Cheers,
Stig

Original comment by stigmann...@gmail.com on 13 Jul 2009 at 11:32