google-analytics icon indicating copy to clipboard operation
google-analytics copied to clipboard

Setting precision fails, outdated docs?

Open GedRap opened this issue 9 years ago • 2 comments

Accordign to this https://github.com/debrouwere/google-analytics/blob/master/googleanalytics/query.py#L614 we can set precision using

query.range('2014-01-01', '2014-01-31', precision='FASTER')

However, it seems to be broken:

TypeError: range() got an unexpected keyword argument 'precision'

range method definition:

range(self, start=None, stop=None, months=0, days=0)

This seems to be working though:

query.precision('HIGHER_PRECISION')

Is it the correct way to set the precision and the docs are simply out of date? If so, I can create a PR fixing this documentation issue :)

GedRap avatar Feb 17 '16 13:02 GedRap

You're right, the documentation seems to be out of date. the range method used to have a lot of different keyword arguments for various things, but I figured it was better to have it only do what it says on the tin: control the reporting range.

Note that I prefer to use the hourly, daily, weekly, monthly and yearly methods myself to be more explicit about the granularity of the report. These will then call range for you.

debrouwere avatar Feb 18 '16 10:02 debrouwere

Code here: https://github.com/debrouwere/google-analytics/blob/85a6fc886e13857ce9363cc17a0df23c273112ae/googleanalytics/query.py#L661

debrouwere avatar Feb 18 '16 10:02 debrouwere