Search by

mettr / statamic

alexbabintsev

mettr for Statamic: live page views, form submissions, sign-ups, crawlers and errors, with an Antlers tag

Package info

github.com/mettrhq/mettr-statamic

Homepage

Type:statamic-addon

pkg:composer/mettr/statamic

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-12-03 19:55 UTC

This package is auto-updated.

Last update: 2026-12-03 19:59:52 UTC


README

Sends a Statamic site's page views, form submissions, sign-ups, crawlers, 404s and errors to mettr, as they happen. Statamic 6, PHP 8.3+. Built on mettr/laravel, which it installs.

Install

composer require mettr/statamic

Add the site's keys (mettr, site settings, "Tracking") to .env:

METTR_SECRET_KEY=sk_...
METTR_PUBLIC_KEY=pk_...

and the script to the <head> of your layout:

{{ mettr }}

(@mettr in a Blade layout.) It sends from production only; set METTR_ENABLED=true to try it elsewhere.

What it sends

Everything mettr/laravel sends: page views and who is online from the script (through /_live on your own domain), sign-ins, 404s, exceptions by class, response times and crawler visits. And, for Statamic:

  • Form submissions (form_submitted), with the form's handle only: never what was typed in it.
  • Sign-ups through Statamic's registration form (signup), as the new user's.
  • Nothing from the control panel: its route (cp, or yours) is added to mettr.ignore, so editors at work are not traffic.
  • People who may use the control panel are staff: their visits send nothing, unless you name your own gate in METTR_STAFF_GATE.

Turn forms off with mettr.track.forms in config/mettr.php (php artisan vendor:publish --tag=mettr-config).

Static caching

With full static caching the web server answers from HTML files and PHP never runs: the script still counts page views and who is online, but crawler visits, 404s and response times of cached pages are not seen. Half-measure caching keeps them.

Your own events

use Mettr\Laravel\Facades\Mettr;

Mettr::event('newsletter', ['list' => 'weekly']);

Your MCP server

If the site runs an MCP server (laravel/mcp, or an addon that adds one), put mettr/laravel's mettr.mcp middleware first on its route, so mettr shows how AI assistants use it (calls, tools, clients, failures and time, never what a call carried) and sends no crawl for it:

Mcp::web('/mcp', SiteServer::class)->middleware(['mettr.mcp', 'auth:api']);

See MCP analytics; the panels come with Pro.

License

MIT.