thirtybittech/mini-metrics
Composer 安装命令:
composer require thirtybittech/mini-metrics
包简介
Privacy-first, self-hosted analytics for Statamic 6, built right into the Control Panel.
README 文档
README
Privacy-first, self-hosted analytics for Statamic 6 — beautifully built into your Control Panel.
Mini Metrics gives you the numbers that actually matter — visitors, page views, top pages, referrers, browsers and countries — without shipping a single byte of your visitors' data to Google, Plausible, or anyone else. No third-party scripts. No cookie banners. No monthly SaaS bill. Just clean, fast analytics that live in your database and look right at home in the Statamic CP.
Visitors, page views and traffic trends — right inside the Statamic Control Panel.
Why Mini Metrics?
- 🔒 Privacy by default — Data never leaves your server. No external trackers, no cookies, GDPR-friendly out of the box.
- 🎨 Native Control Panel UI — Built entirely with Statamic 6's own components, so it feels first-party and looks perfect in both light and dark mode.
- ⚡ Zero configuration — Install, migrate, done. Page views are recorded automatically for every front-end request.
- 📅 Flexible date ranges — Jump between Today, 7 / 30 days, 6 / 12 months, or pick an exact custom range from a calendar.
- 🪶 Lightweight by design — A focused, no-bloat feature set. It's called Mini for a reason.
- 🗄️ Scales with you — Point the high-volume analytics data at a separate database connection so it never bloats your main app database.
Features
- Visitors & page views at a glance
- Visitor timeseries — a clean area chart that adapts its buckets (hourly → daily → weekly → monthly) to the range you pick
- Top Pages — your most-visited URLs
- Top Referrers — where your traffic comes from
- By Browser and By Country breakdowns
- Show more / less on every list, so long tables stay tidy
- Custom date ranges via a native calendar picker
Top referrers, browsers and countries — with "Show more" to expand longer lists.
Preset windows or an exact custom date range, in light or dark mode.
Requirements
- Statamic 6, Laravel 12, PHP 8.3+
- The
intlPHP extension (used to resolve country names)
Installation
composer require thirtybittech/mini-metrics php artisan migrate
That's it — page views are recorded automatically from here on.
Usage
The dashboard lives in the Control Panel under Utilities → Mini Metrics
(/cp/utilities/mini-metrics). Browse your site to generate some traffic, then open it
to see your stats. Use the Range selector at the top right to switch between Today,
7 / 30 days, 6 / 12 months, or a custom date range from the calendar.
Mini Metrics is a utility, so it's available to any CP user with access to Utilities.
Configuration
Publish the config file to customise the addon:
php artisan vendor:publish --tag=mini-metrics-config
Keep analytics off your main database
Mini Metrics writes a row for every front-end request, so on busy sites you may want to
keep this data in its own database. Add the credentials to your .env — the addon
registers the connection for you, no config/database.php edits required:
MINI_METRICS_DB_CONNECTION=mini_metrics MINI_METRICS_DB_HOST=127.0.0.1 MINI_METRICS_DB_PORT=3306 MINI_METRICS_DB_DATABASE=mini_metrics MINI_METRICS_DB_USERNAME=root MINI_METRICS_DB_PASSWORD=secret
Create the database, then run php artisan migrate to build the page_views table on
that connection. Leave MINI_METRICS_DB_CONNECTION unset to use your app's default
connection. Already have a connection defined in config/database.php? Just set
MINI_METRICS_DB_CONNECTION to its name.
Set the connection before the first migration. If you change it afterwards, re-run the migration against the new connection.
Exclude paths
Requests matching any pattern in the exclude array are ignored (wildcards supported):
'exclude' => [ 'assets/*', 'cart/*', ],
How it works
A lightweight middleware records a page view — URI, referrer, browser, country and device
— to a page_views table via Eloquent. The Control Panel dashboard reads it back with
simple aggregate queries. No queues, no external calls, no magic.
License
Mini Metrics is open-source software released under the MIT License.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-12


