Getting a sum in the api results?

Hi there,

I’m trying to get some data through remote calls to the api.
Overall it doesn’t make too much sense for data like countries and browser types to be by day if you request it for a given timeframe.
Therefore I’d like to show the sums over the selected timeframe in (for example) a pie chart.
But the api returns the data by day. Do I really need to compute the sum on the receiving side or is there some magic parameter I’m missing?

Thanks,

thomas

yes you need to process them in your code. later, we will add possibility for custom date range, piwik will then do the sum itself. http://dev.piwik.org/trac/ticket/572

Thanks, I’m doing that already and its working fine so far.

Ah yeah, I read that. I’m a bit confused though about the “custom date range” discussion.
I’m requesting data from the api with custom date ranges already as I build two date selectors on top of my statistics page as from/to parts. The period is just a grouping for these results.
Where’s the problem then? I must be missing something obvious :-).

Regards,

Thomas

With custom date range, you can replace period=day by period=range and then Piwik will automatically sum the data for you (also it is faster since Piwik does the sums rather than requesting all data separately then sum on the client side)

Matt, you mention you can specify “period=range” but does this only work in 1.3 as per Core: Provide custom date range feature · Issue #572 · matomo-org/matomo · GitHub ? I’m trying to get the last x days of data for Referers.getKeywords so it’d be a little heavy to set filter_limit to 1 and iterate/sum every value for each day.

You can use latest RC: 301 Moved Permanently