prayagverma / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

No support for 'segment' in Analytics API #396

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
gdata.analytics.service.AnalyticsDataService.GetData() doesn't include a 
parameter for 'Segment' preventing users from specifying segments in their 
queries. 

What version of the product are you using?
2.0.10

Please provide any additional information below.
Would like to specify the segment: dynamic::ga:pagePath=~/software/. along with 
the metric ga:visitors. I first attempted to put ga:pagePath=~/software/. in 
the filters, but got a IllegalDimensionMetricCombinationException so when I 
looked for segments in the API and couldn't find them, I posted this issue.

Original issue reported on code.google.com by wearesch...@gmail.com on 29 Jun 2010 at 11:35

GoogleCodeExporter commented 9 years ago
So after more searching I found this comment in the API:

  Alternatively you can add new parameters directly to the query object.
     queryUrl = DataFeedQuery()
     queryUrl.query['max-results'] = '10000'

Meaning I can just add 'segment' to my query via this method. Problem solved.

Original comment by wearesch...@gmail.com on 30 Jun 2010 at 5:51

GoogleCodeExporter commented 9 years ago
I tried the above method of adding a segment e.g.:

query['segment']='dynamic::ga:pagePath=~/software/'

and this does indeed append the segment parameter to my data feed URI, but the 
data that gets returned doesn't seem to have been altered by the segment at 
all. I checked the URI the python URI created against one created by the Data 
Feed Query Explorer and they are the same. So why is the data being returned 
different?

Original comment by wearesch...@gmail.com on 1 Jul 2010 at 12:16

GoogleCodeExporter commented 9 years ago
I'm seeing this issue as well, and seem to be able to reproduce it outside of 
the Python gData package. I built a request and hit the API using httplib2, and 
received the same inaccurate results that I did as using the gData tools. It 
seems like segments are just being ignored.

Original comment by xxf4n...@gmail.com on 27 Jul 2010 at 9:15

GoogleCodeExporter commented 9 years ago
Was having the same problem where segment was not being honored. Turns out that 
gdata internally uses version 1.0 of the API by default. You have to override 
that header by adding extra headers to your API call. In the python client, 
this looks like this:

extra_headers = { 'GData-Version' : '2' }
feed = self.client.GetFeed(feed_url, extra_headers=extra_headers)

Original comment by shabbir....@gmail.com on 29 Jul 2010 at 11:03

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 19 Dec 2011 at 12:33