Open GoogleCodeExporter opened 9 years ago
What's the status on this?
Original comment by i...@kryap.com
on 6 May 2011 at 12:16
[deleted comment]
I have tried to retrieve a custom variable - without success.
Here is my request call, which includes customVarValue1.
...
$ga->requestReportData(ga_profile_id, array('visitorType', 'customVarValue1',
'networkDomain', 'hostname', 'pagePath', 'date', 'hour'),
array('pageviews','visits'));
No results are returned.
But if I exclude customVarValue1, I get results.
Original comment by colin.go...@gmail.com
on 14 Jun 2011 at 3:05
Hi,
I am using GAPI version 1.3
I have added a custom variable in GA code like this:
_gaq.push(['_setCustomVar', 1, 'Member', '<?php echo $member_id; ?>, 3]);
And its working fine..
Now I need to fetch the data from GA: so my requst to GA is like this:
https://www.google.com/analytics/feeds/data?
ids=XXXXXXXXXXX&
dimensions=ga:customVarValue1,ga:pagePath&
metrics=ga:pageviews,ga:uniquePageviews,ga:bounces,ga:exits&
filters=ga:pagePath=@event_details.php;ga:customVarValue1=2004036442&
start-date=2011-04-20&
end-date=2011-05-04&
max-results=50
I need to fetch data from GA where pagePath=@event_details.php AND
ga:customVarValue1=2004036442
But this is not resulting anything...
When I changed the filters in the following why its resulting all the pagePath
= event_details.php and its working fine..
filters=ga:pagePath=@event_details.php
but I need get the page path with the perticular member ID that is why I used
the condition as below:
filters=ga:pagePath=@event_details.php;ga:customVarValue1=2004036442&
I have also tried like this and this is also not working
https://www.google.com/analytics/feeds/data?
ids=XXXXXXXXXXX&
dimensions=ga:customVarValue1,ga:pagePath&
metrics=ga:pageviews,ga:uniquePageviews,ga:bounces,ga:exits&
filters=ga:pagePath=@event_details.php&
segment=dynamic::ga:customVarValue1==1041533899&
start-date=2011-04-20&
end-date=2011-05-04&
max-results=50
So any one have idea about this?? Please help me..
Original comment by contactv...@gmail.com
on 28 Jul 2011 at 11:21
You should be able to retrieve custom variables as long as custom variables
have been captured in the date range you sent.
As far as filtering by them, this is a bit of a bug in the GAPI class. To fix
it you can either (as others have suggested) prefix your customVarValue{n} and
customVarName{n} values with "ga:". For example: "ga:customVarValue1 ==
myvariable" instead of "customVarValue1 == myvariable".
Or you can open up the gapi.class.php file and edit line 235, changing:
$filter = preg_replace('/(&&\s*|\|\|\s*|^)([a-z]+)(\s*' . $valid_operators .
')/i','$1ga:$2$3',$filter);
to:
$filter = preg_replace('/(&&\s*|\|\|\s*|^)([a-z0-9]+)(\s*' . $valid_operators .
')/i','$1ga:$2$3',$filter);
Just added a 0-9 to the regular expression character class so it will properly
prefix the custom variable filters.
Original comment by char...@dwstudios.net
on 23 Feb 2012 at 10:40
Original issue reported on code.google.com by
jvsiva2...@gmail.com
on 1 Sep 2010 at 6:09