There will be a Dashboard page which displays the following 4 rows of widgets:
Row 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 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.
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.
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.
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
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:
the presentation in Filament (if presentation_id) is provided
(Admin Only) the adhoc presentation on the live site (if adhoc_slug is provided)
(Admin Only) the instructions (if neither presentation_id or adhoc_slug are provided). This will surely be the most viewed presentation that the admin sees
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
When a presentation is viewed (either AdhocSlidesController#index, AdhocSlidesController#show, or PresentationController#show), store a record in daily_views
Won't store view data if you are viewing your own presentation (meaning you're authenticated and viewing it).
Aggregating Views
Create a job that aggregates all records in daily_views by presentation ID and/or slug, unique by session id, and creates a single record in aggregate_views with the date and count of views. Then, truncate the daily_views table.
Run the job daily via the scheduler
New Database Tables
daily_views
id
presentation_id (foreign key, nullable) - index
adhoc_slug (string, nullable) - index
session_id - index
timestamps
compound index for presentation_id and adhoc_slug
compound index for presentation_id, adhoc_slug, and session_id
aggregate_views
id
presentation_id (foreign key, nullable) - index
adhoc_slug (string, nullable) - index
total_count (int, default 0) - index
unique_count (int, default 0) - index
date (date)
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.
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
Row 2
Affected by both presentation and date filters.
Row 3
Only affected by presentation filter.
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
daily_views
Aggregating Views
daily_views
by presentation ID and/or slug, unique by session id, and creates a single record inaggregate_views
with the date and count of views. Then, truncate thedaily_views
table.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
andadhoc_slug
are null, then that is indicative of the root Instructions page.