page_analytics
Page Analytics provides simple, server-side page view analytics for Drupal. No JavaScript tracking or third-party services are required. It records daily view counts without affecting the page load and displays an admin report with charts for a given period. All data is stored in your database and processed via Drupal's queue on cron.
Post-Installation
To see data in the report: visit some front-end pages (as an anonymous user if "Exclude logged-in users" is on), then run cron. The queue worker runs on cron and writes to the analytics table. This keeps page responses fast by doing the database work in the background instead of during the request.
Cron: Run cron often (e.g. every 15 minutes). If cron runs rarely, the queue can grow large and a single cron run may process many items at once, which can temporarily overload the server. Frequent cron keeps batches small.
Report
See the report in Reports » Page analytics. Charts show daily view counts for the selected period (7 or 30 days).
How it works
- On each successful (200) response for a non-admin path that is not a static asset, the module may enqueue a view (subject to sampling and optional exclusion of authenticated users). Paths under `/admin` and asset file extensions (e.g. `.jpg`, `.png`, `.js`) are not tracked. Paths longer than 255 characters are truncated.
- Eligible page views are added to the `page_analytics` queue
- When cron runs, the queue worker upserts into the `page_analytics_daily` table (path + date, incrementing view count). The worker processes up to 100 items per cron run and respects the configured sampling rate when estimating totals.
- The report reads from `page_analytics_daily` and uses the configured retention so that old rows are removed on cron.
Similar modules
- Statistics — Counts entity views (nodes only, full page mode). Tracks a running grand total and daily subtotal per node with no historical data. Lightweight and privacy-friendly (no PII collected). Moved out of Drupal core into a contributed module as of Drupal 10.3.
- Visitors — Comprehensive visitor analytics with detailed user tracking (IP, location, browser, device, OS) and server/browser performance metrics. Integrates with Views and Charts for reporting. Collects more data than Page Analytics but includes personally identifiable information.