Open GoogleCodeExporter opened 9 years ago
[deleted comment]
import com.google.gdata.client.analytics.DataQuery;
DataQuery query = new DataQuery(new URL(baseUrl));
query.setSegment("gaid::-11");
setSegment(..) is not considering DataQuery mathod Why ?
please suggest about it .
Original comment by scea.web...@gmail.com
on 8 Jan 2010 at 10:30
Having the same problem - filtering by advanced segments works within the Data
Feed
Query Explorer, but does not seem to work with the actual Data API.
Original comment by kploe...@gmail.com
on 22 Jan 2010 at 6:00
I needed segment support for a current project, there are two problems with
GAPI. First and foremost it
simply doesn't implement support for segments despite the simplicity of such an
endeavour - dynamic
segments are treated very much like filters.
The file attached is updated with segment support and also uses the API V2.
I've no idea what potential impact
the latter change may have to your code, so use extreme caution when using this.
When using requestReportData you should now do:
requestReportData($report_id, $dimensions, $metrics, $sort_metric, $filter,
$segment, $start_date,
$end_date, $start_index, $max_results)
Segment has been inserted immediately after filter and you should use the same
syntax.
I have also allowed $dimensions to be set to null.
Original comment by wraithof...@gmail.com
on 25 Jan 2010 at 1:32
Attachments:
[deleted comment]
Thanks wraithofdark, your contribution is well appreciated :)
Original comment by mathieu....@gmail.com
on 30 Jun 2010 at 3:35
@wraithof
thanks for sharing your solution, its works perfectly for me :)
Original comment by oliverte...@googlemail.com
on 6 Feb 2011 at 10:05
Major thanks to wraithofdark!
I did find one issue and wanted to give back.
When trying to use dynamic segments with an AND statement using a semicolon,
all of the results were returning zero.
I did some debugging and it worked after commenting out the line that was
escaping commas and semicolons as such:
// $segment = str_replace(array(',',';'),array('\,','\;'),$segment); //Escape
Google Analytics reserved characters
Original comment by pru...@gmail.com
on 3 Mar 2011 at 9:19
Hi
How to use customVarValue1 in the filters/segment condition in Google Analytics
Data API?
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 27 Jul 2011 at 6:34
Figured this one out....ugh, what a pain. The gapi_class file attached to this
thread is great for pulling segments, however you couldn't call the
getTotalResults() function like you could against a standard call...I found
that the xml comes back with different headers, and the openseach protocol is
different.
Find in gampi.class.php "http://a9.com/-/spec/opensearchrss/1.0/" and replace
with "http://a9.com/-/spec/opensearch/1.1/" and you can access the objects
properly now.
Original comment by parallel...@gmail.com
on 26 Aug 2011 at 5:21
"Segment has been inserted immediately after filter and you should use the same
syntax."
with this, how would you use a segment like "page contains xyz"? I mean there
are no php operators for contains, right?
Original comment by terry.po...@melbourneitdbs.com
on 30 Aug 2011 at 1:47
Has anyone had any probs with this?
I get errors with 'v'=>'2'.
It works without it, but whatever I put in $segments it doesn't change the data.
Original comment by mattheww...@gmail.com
on 19 Apr 2012 at 11:14
Dear wraithof...@gmail.com,
What is right syntax for your class for $segments parameter in
requestReportData($report_id, $dimensions, $metrics, $sort_metric, $filter,
$segment, $start_date,
$end_date, $start_index, $max_results). I used
1. 'gaid::mySegmentID'
2. 'gaid=mySegmentID'
3. 'segment=mySegmentID'
But none of this is working. Can you help me?
Thanks in advance!
Original comment by hakobyan...@gmail.com
on 17 Aug 2012 at 1:54
If anyone is interested, there is a gapi class adapted to OAuth2 login method
in this website:
http://www.brightyoursite.com/blog/2012/08/14/gapi-google-analytics-latest-versi
on-with-oauth-2-0
I have tried it and it works, but lacks the part of the code that deals with
segments. I tried to modify it, but cant figure out why it won´t work with
segments. I attach my class just in case someone wants to check it out. Any
help would be appreciated!
Original comment by i...@overalia.com
on 6 Feb 2013 at 8:12
Attachments:
Original issue reported on code.google.com by
Mur...@gmail.com
on 16 Dec 2009 at 8:09