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

Add feature "operation=sum" to sum data from several periods in the API request #5716

Closed
zawadzinski opened this issue Jul 10, 2008 · 3 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.

Comments

@zawadzinski
Copy link
Contributor

We need to get the sum of statistics data from the “beginning” which means from the moment we added site to the system (ts_created field in site table).

It can be very useful for example in video plugin when we can get the sum of all video events (i.e. video_play) from the first time video appeared online. It is quite important feature.

To do what you want to do, the best thing I can think of is to build a filter that would sum up the DataTable_Array of every year and output only the sum.this could look like:

```
?module=API&method=VisitFrequency.getVisitsReturning&idSite=1&period=year&date=last10&format=xml
&operation=sum
```

This filter could use the DataTable::addDataTable
The only thing to think of is that the DataTable_array could be simple:

```
date=A
data A
date=B
data B
```

looping over the set and sum the datatable should work.

For the version where the rows are themselves made of dataTable_Array

```
idsite=1
date=A
data A
date=B
data B
idsite=2
date=A
data C
date=B
data D
etc.
```

we want the output

```
idsite=1
data A+B
idsite=2
data B+D
```

Keywords: outofscope

@mattab
Copy link
Member

mattab commented Feb 2, 2009

Important note: when summing web analytics data, we have to make sure we don’t sum some fields like “nb_uniq_visitors”, as it is not correct to sum uniques

@mattab
Copy link
Member

mattab commented Mar 21, 2010

I believe this should be done on the client side. marking as won't fix for now.

@mattab
Copy link
Member

mattab commented Mar 23, 2011

Actually this feature is really Custom Date Range since all it does is summing the data and caching it like a normal report, see #572

@zawadzinski zawadzinski added this to the Future releases milestone Jul 8, 2014
@mattab mattab removed the wontfix label Aug 3, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants