electerious / Ackee

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

Per page statistics #234

Closed ManUtopiK closed 3 years ago

ManUtopiK commented 3 years ago

šŸ£ Is your feature request related to a problem? Please describe.

I wonder if we can fetch per page statistics with the graphql API? I explored a lot but don't found a way to do that.

šŸ’” Describe the solution you'd like

Exemple to fetch total view, extend type DomainStatistics with View() query like this:

view(
    id: URL!
    interval: Interval!
    limit: Int = 14
): [View!]
electerious commented 3 years ago

Not sure if that's what you're looking for, but there's a pages field you can query:

pages(sorting:Ā Sorting! range:Ā RangeĀ =Ā LAST_7_DAYS limit:Ā IntĀ =Ā 30 ):Ā [Page!] On 4. Mar 2021, 00:25 +0100, Emmanuel Salomon notifications@github.com, wrote:

šŸ£ Is your feature request related to a problem? Please describe. I wonder if we can fetch per page statistics with the graphql API? I explored a lot but don't found a way to do that. šŸ’” Describe the solution you'd like Exemple to fetch total view, extend type DomainStatistics with View() query like this: view(

id: URL!

interval: Interval!

limit: Int = 14

): [View!] ā€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ManUtopiK commented 3 years ago

Thanks for your response. No. It's not that I want. Sorry, maybe I misspoke. I would like to get view statistics per page. As we can get with view but for one page:

query stats {
    domain(id: "d007c978-97a6-4bb7-b2f8-43a635c317df") {
       statistics {
       views(
                interval: DAILY
                type: TOTAL
            ) {
                id
                count
            }
        }
    }
}

The result is something like:

"data": {
    "domain": {
      "statistics": {
        "views": [
          {
            "id": "2021-03-05T21:39:35.992Z",
            "count": 243
          },
          {
            "id": "2021-03-04T21:39:35.992Z",
            "count": 193
          },
          {
            "id": "2021-03-03T21:39:35.992Z",
            "count": 288
          }
...

Note field id is strange for a date. Anyway, those results are for the whole domain, not about one unique page. It could be useful to obtain stats per page. Something like:

query stats {
    domain(id: "d007c978-97a6-4bb7-b2f8-43a635c317df") { // or just `domains {`
       statistics {
       views(
                id: "https://mywebsite.org/theUrlOfThePageIWant"
                interval: DAILY
                type: TOTAL
            ) {
                id
                count
            }
        }
    }
}
electerious commented 3 years ago

Ahh I see. I like the idea, but I currently have no use-case in the UI for it. It's therefore nothing I'm planning to add.

ManUtopiK commented 3 years ago

I'm currently working on it here: https://github.com/ManUtopiK/Ackee/tree/viewsPerPage

mab253 commented 1 year ago

I would also be very interested in views per page for older than 6 months - @ManUtopiK any luck here?!

(I'm hoping to be able to build a cumulative all-time count in the dashboard as well, for pages specifically)

ManUtopiK commented 1 year ago

Sorry. I had no help with this feature. I switched to https://github.com/umami-software/umami

mab253 commented 1 year ago

I was able to adjust the range filters to show "Last 12 Months," "Last 7 Years" (and I believe you could go higher, essentially giving yourself an "All Time" statistic for page views)!

For @ManUtopiK and anyone else looking: https://github.com/UnlockNYC/Ackee/commit/3a70457ed2595fe288f4698914f5d595d35a6598