mfts / papermark

Papermark is the open-source DocSend alternative with built-in analytics and custom domains.
https://papermark.io
GNU Affero General Public License v3.0
3.49k stars 430 forks source link

✨ feat: Document analytics data export capabilities #248

Open ashrafchowdury opened 8 months ago

ashrafchowdury commented 8 months ago

Description

I propose integrating a robust document analytics data export functionality within the system so that users can easily export their data. This feature aims to enhance the platform's capabilities by allowing users to export detailed analytics data for further analysis and reporting.

Notes:

  1. This feature is available on Roadmap #74 and no one is working on it currently.
  2. As you mentioned on that issue of exporting data in CSV format, I'm taking that.
  3. Below I added a short video about my experiments with this feature, you can check it out. How was that?

Technical issues:

I have created a custom hook to abstract all the necessary data from different components by hooks, but the problem is we don't have any useEffect hook or any function that will run when data loads. So there are two possible solutions in my mind:

  1. Use the useEffect hook in every component to send the analytics data on that custom hook.
  2. Call all the necessary swr hooks, like use-document, use-stats on that custom hook to fetch data on the spot and export the data.

I want to know your opinion on which option is better or share a better suggestion.

Feature Preview

https://github.com/mfts/papermark/assets/87828904/29f45226-7013-4911-952d-810d505e11c2

mfts commented 6 months ago

Thanks for putting in the effort @ashrafchowdury. I like your approach.

One way, I was thinking about it is you can trigger a function when the user presses the button which fetches the data from tinybird (probably via a new tinybird pipeline) and downloads it for the user.