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.43k stars 2.6k forks source link

Improve Exported file names #7308

Open ghost opened 9 years ago

ghost commented 9 years ago

Currently, when you export custom variables in CSV or TSV, you get a file name like: "Piwik Exporter [start date] - [end date] .csv"

It would be a nice feature to have an extra GET variable to name the file. Example: "downloadName=mySpecialReport" would give: "Piwik Exporter mySpecialReport [start date] - [end date] .csv"

mattab commented 9 years ago

Thanks for suggestion @rogertheshrubber

maybe we could automatically include the report name in the filename eg. Piwik Exporter _ Custom Variables _ [start date] - [end date] .csv

and even maybe add the website ID or name Piwik Exporter _ Custom Variables _ [start date] - [end date] _ Website $NAME_HERE .csv

ghost commented 9 years ago

That would be good by default, but I still think it would be better to set your own name somehow. At work we're creating multiple reports with several custom variables. We won't be exporting all custom variables in one report, but rather different groups of custom variables in different reports. If we were to export all of them, we couldn't tell the difference between each report by the name.

martenkoetsier commented 2 years ago

My biggest issue in the filenames is the date formatting. The reports are currently named with the $prettyDate, which causes the reports to be not sortable. I would strongly prefer the ISO date format in the filename (e.g. 2022-01-03) because that is sortable. Sorting is important when you want to find a specific report in a directory with many reports.

Perhaps there could be an option "local date formatting or ISO8601 formatting"?

tsteur commented 2 years ago

Indeed @martenkoetsier that could be improved. What do you suggest what it would look like for weeks or other date ranges? like Export _ Exit pages _ week 2022-01-03 to 2022-01-09.csv? A problem might be also different date formats which we would probably need to respect as sometimes the order of day / month / year is different. Having the month in the name written makes this bit more clear

martenkoetsier commented 2 years ago

@tsteur Yes, that format would work. The part before the date (Export _ Exit pages _ week, or in my cases for example Report the-name -) will remain the same over time. Thus with many reports stored in a directory it does not influence ordering.

Respecting local date formatting is great for everyone who wants it. Indeed, the order of the fields is different for various languages, making a date such as 2/3/2022 ambiguous and that could be solved by writing the month as a name. However, the issue with that is that it sorts non-chronological. That's why I suggested to (optionally) make use of the ISO8601 formatting, which is always clear: the largest "temporal term" always comes first: year, month, day. No need to replace the numbers with names anymore.

I have not yet found any way to set the date formatting in Matomo. It might be linked with some language setting. I do need Matomo to be in English, not any other language (even though I am Dutch). With this, the "pretty date" is Weekday_name, Month_name day_of_month, Year (year with 4 digits). As an illustration, my daily reports are therefore ordered as:

I think everyone understands that finding a specific report is not easy. Hence my desire to name them:

Report some-name - yyyy-mm-dd.pdf

or

Report some-name - yyyy-mm-dd <dayname>.pdf

Or for weekly reports (ISO8601 has a format for that too):

Report some-name - week yyyy-Www.pdf

or just

Report some-name - week yyyy-mm-dd to yyyy-mm-dd.pdf

And for monthly reports:

Report some-name - month yyyy-mm.pdf

All these options share one essential property: they are easily sorted in chronological order of the report-period.