Moodle Plugins directory: Resource Stats | Moodle.org
Resource Stats
Resource Stats is a Moodle local plugin that tracks and displays access statistics for course modules directly on the course page.
It shows teachers how many times each resource or activity has been accessed — total views and unique students — without requiring any third-party analytics tool.
✨ Features
- 📊 Access Badges: Small badges displayed below each resource on the course page, visible only to teachers.
- 👤 Unique Student Count: Tracks how many distinct students accessed each module.
- 🔁 Total View Count: Tracks repeated accesses, counting every visit individually.
- 📅 Per-Student Statistics: Dedicated page showing each student's view count, first access date, and last access date.
- 🔢 Site-wide Default: Administrators choose the default badge mode for teachers who have not set a personal preference. Factory default is none — the plugin installs quietly and teachers opt in.
- ⚙️ Display Preferences: Each teacher overrides the site default via the Statistics link in the course navigation (tab bar / More overflow).
- 🔒 Privacy-Aware: GDPR erasure deletes per-student rows and transfers their view counts into aggregate columns (
deletedviews,deletedcount) — no nullable user IDs in unique indexes (SQL Server compatible). - ✅ GDPR Compliant: Full Privacy API implementation with data export and deletion support.
🎓 Educational Purpose
Resource Stats is designed to support teachers in data-driven course management:
- Monitor engagement: Identify which resources and activities are being accessed and how frequently.
- Detect non-participation early: Spot students who have never accessed a given material and intervene before they fall behind.
- Evaluate resource effectiveness: Low access counts may signal that a resource is poorly positioned, unattractive, or unclear — prompting a pedagogical review.
- Improve course structure: Use access patterns over time to make evidence-based decisions about content sequencing and relevance.
Suitable for:
- Online and hybrid courses where access visibility is limited
- Courses with self-paced materials where participation is harder to track
- Teachers who want to act preventively rather than reactively
📖 Usage
After installation, the plugin records views in the background for students only (guests and teachers with manageactivities are never tracked).
Teachers:
- By default, no badges are shown until the site administrator sets a different default or the teacher opts in.
- Open the course and click Statistics in the course navigation (it may appear under More if the tab bar is full). Choose a display mode and save.
- Once a non-none mode is active, small access badges appear below each module on the course page.
- For the full per-student breakdown, open any module and click the Statistics tab in the module settings navigation.
Site administrators:
- Go to Site administration > Plugins > Local plugins > Resource Statistics.
- Set Default display mode. Factory setting is Don't display anything.
Badge display modes:
| Mode | Description |
|---|---|
none |
Hides all badges (factory default) |
unique |
Shows unique student count only |
total |
Shows total view count only |
both |
Shows both counts and last viewer information |
The Default badge on the preferences page reflects the administrator's site-wide default, not a hardcoded value.
🔐 Security & Compliance
- Capability-based access control (
moodle/course:manageactivities) - No teacher or guest views are ever recorded
require_sesskey()protection on all POST actions- Labels are excluded (they never fire a view event)
- GDPR: per-student rows are deleted on erasure; view counts are accumulated in aggregate columns so totals stay meaningful without storing identifying data
⚠️ Course Format Compatibility
Resource Stats works with any course format that uses Moodle's standard activity rendering ([data-region="activity-card"]), which includes the built-in Topics, Weeks, and Single Activity formats.
Third-party formats that replace the standard module HTML with a custom layout (such as visual trail or board formats) may not display the badges on the course page. The statistics page and data collection are not affected — only the badge display.
Comments