Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics does not do the right thing for segments #2713

Closed
changhiskhan opened this issue Jan 20, 2013 · 1 comment
Closed

Google Analytics does not do the right thing for segments #2713

changhiskhan opened this issue Jan 20, 2013 · 1 comment
Assignees
Labels
Bug IO Data IO issues that don't fit into a more specific label
Milestone

Comments

@changhiskhan
Copy link
Contributor

I'm getting an error with the segment option now. When I go to the query explorer, my segments look like this: "gaid::707967480"
http://ga-dev-tools.appspot.com/explorer/

So the error I'm getting is related to that string construction - is this a bug, or is this somehow my segment ids?

ValueError Traceback (most recent call last)
in ()
----> 1 df = ga.read_ga(['pagePath', 'date'], dimensions=['avgTimeonPage'], start_date='2012-09-01', segment=['742193199'], secrets='./client_secrets.json')
2 df

C:\Python27\lib\site-packages\pandas-0.10.0-py2.7-win32.egg\pandas\io\ga.pyc in read_ga(metrics, dimensions, start_date, **kwargs)
94 reader = GAnalytics(**reader_kwds)
95 return reader.get_data(metrics=metrics, start_date=start_date,
---> 96 dimensions=dimensions, **kwargs)
97
98 class OAuthDataReader(object):

C:\Python27\lib\site-packages\pandas-0.10.0-py2.7-win32.egg\pandas\io\ga.pyc in get_data(self, metrics, start_date, end_date, dimensions, segment, filters, start_index, max_results, index_col, parse_dates, keep_date_col, date_parser, na_values, converters, sort, dayfirst, account_name, account_id, property_name, property_id, profile_name, profile_id, chunksize)
283
284 if chunksize is None:
--> 285 return _read(start_index, max_results)
286
287 def iterator():

C:\Python27\lib\site-packages\pandas-0.10.0-py2.7-win32.egg\pandas\io\ga.pyc in _read(start, result_size)
279 except HttpError, inst:
280 raise ValueError('Google API error %s: %s' % (inst.resp.status,
--> 281 inst._get_reason()))
282
283

ValueError: Google API error 400: Invalid value 'ga:742193199' for segment.

@ghost ghost assigned changhiskhan Jan 20, 2013
changhiskhan added a commit that referenced this issue Jan 20, 2013
@changhiskhan
Copy link
Contributor Author

fixed. also able to handle dynamic segment: segment='source=~twitter'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

No branches or pull requests

1 participant