alkrauss48 / simple-slides

Simple Slides is a responsive and text-first presentation tool that keeps your audience engaged.
https://simpleslides.dev
MIT License
44 stars 8 forks source link

Add Analytics #16

Closed alkrauss48 closed 5 months ago

alkrauss48 commented 7 months ago

Dependent on #17

We need to add analytics capabilities that show:

Dashboard Widgets

There will be a Dashboard page which displays the following 4 rows of widgets:

Row 1

  1. Searchable drop down for presentations that the user has access to a. Default to "All" b. If admin, will include "Instructions" and "Adhoc" presentations c. If admin, will show presentation names with the creator of the presentation d. Will remember selection
  2. 2 Date range fields from "Start" to "End", making sure that only "up to yesterday" can be selected. Default the values from a week before yesterday up to 8 days ago (aka the past week).

Row 2

Affected by both presentation and date filters.

  1. Number of visitors in range (scalar) a. Can use Filament's Stat Widget to show a number: https://filamentphp.com/docs/3.x/widgets/stats-overview b. Show subtext of total number (and percentage) of unique visitors c. Make it 1/3 width e. Note: Won't include "today's" values; only up to the previous day.
  2. Line chart showing the number of visitors within range (trend graph) a. Can use Filament's Chart Widget to build the chart: https://filamentphp.com/docs/3.x/widgets/charts b. Show two lines: one of total, and one of unique visitors. c. Make it 2/3 width

Row 3

Only affected by presentation filter.

  1. Number of realtime visitors today (scalar) a. Can use Filament's Stat Widget to show a number: https://filamentphp.com/docs/3.x/widgets/stats-overview b. Show subtext of total number (and percentage) of unique visitors c. Make it 1/2 width d. Will show increase from the previous day
  2. Number of lifetime views (scalar) a. Can use Filament's Stat Widget to show a number: https://filamentphp.com/docs/3.x/widgets/stats-overview b. Show subtext of total number (and percentage) of unique visitors c. Make it 1/2 width

Row 4

A table of "Most Viewed Presentations", which lists out the aggregate_views records that a user should see, and links to either:

Table will be sorted by total count, but could be sorted by unique count too. This table is not affected by the filters.

Tracking

Generating New Views

Aggregating Views

New Database Tables

daily_views

compound index for presentation_id and adhoc_slug compound index for presentation_id, adhoc_slug, and session_id

aggregate_views

compound index for presentation_id and adhoc_slug

For both tables, if presentation_id and adhoc_slug are null, then that is indicative of the root Instructions page.