electerious / Ackee

Self-hosted, Node.js based analytics tool for those who care about privacy.
https://ackee.electerious.com
MIT License
4.2k stars 350 forks source link

Any way to get complete history for pages visits? #365

Open alexeyqu opened 11 months ago

alexeyqu commented 11 months ago

Hi, I am new here and curious if it is possible to query complete view counts for a page?

The getDomains.statistics.pages query needs a range param which can't be null and only allows to query data up to 6 months.

So, 2 questions (I could probably figure this out from code but want to confirm) 1) are the views stored indefinitely in the DB? i.e. does Ackee delete 6 months+ old records? 2) is there any way to query that historic data from the API? IMO the simplest idea would be to make the range param nullable which will allow to not have any created filters in the aggregations.

Happy to make a PR for the latter. Thanks!

mab253 commented 9 months ago

I'm also very interested in this! I was surprised to see that the API is limited by the same range (LAST_6_MONTHS) that we see in the UI. I'm hoping to be able to see all-time page view counts and add this feature to the dashboard.

From cursory exploration in the MongoDB it looks like all the records are still there ... so being able to query them all in the API would be fantastic!

mab253 commented 9 months ago

I did end up figuring this out! Re your questions @alexeyqu:

  1. The MongoDB does keep all of the events, views, etc.
  2. You do have to change the range filters in the code in multiple places, but I was able to add "Last 12 Months" as well as "Last 7 Years" (and I believe there would be no limit here)

Check it out here: https://github.com/UnlockNYC/Ackee/commit/3a70457ed2595fe288f4698914f5d595d35a6598

stfnhmplr commented 6 months ago

@mab253 This works fine. It would be great if at least the "Last 12 Months" option gets merged. Could be helpful for a yearly review. Did you consider creating a PR for this?