thirtybittech/mini-metrics 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

Mini Metrics dashboard

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

Referrers, browsers and countries

Top referrers, browsers and countries — with "Show more" to expand longer lists.

Range selector with custom range

Preset windows or an exact custom date range, in light or dark mode.

Requirements

  • Statamic 6, Laravel 12, PHP 8.3+
  • The intl PHP 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固