matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.67k stars 2.62k forks source link

Support for date=previousX for csv/tsv format in Analytics API #3412

Open anonymous-matomo-user opened 11 years ago

anonymous-matomo-user commented 11 years ago

For e.g. method=Referers.getRefererType it is no problem to get the statistics for &date=previous1&period=month&format=xml (i.e. in xml format)

Same holds true for format=json.

However, this is not possible for tsv format with &date=previous1&period=month&format=tsv (same for format=csv). This gives the following error:

Error: Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information)

The API should be consistent and allow also csv/tsv format for this. Possibly, there are also other methods than Referers.getRefererType that have this behaviour.

Background: I would like to grab the previous month's statistics but not in xml but csv/tsv format. This feature request results from the discussion at http://forum.piwik.org/read.php?2,94478,94480

mattab commented 11 years ago

Thanks for the report. If you'd like to have the bug fixed quickly please consider sponsoring the fix.