Skip to content
New Bring your history: import it from Google Analytics, Plausible, Simple Analytics, Umami, Matomo or GoatCounter, on every plan

Statamic

The mettr/statamic addon sends a Statamic site's page views, form submissions, sign-ups, crawler visits, 404s and errors, and leaves the control panel out.

Statamic 6, PHP 8.3 or later. It is built on the Laravel SDK, which it installs, so everything there applies. The source is on GitHub, MIT licensed.

Install

composer require mettr/statamic

Add the site's keys (the site's 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 the Laravel SDK 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.

To send no form submissions, publish the config (php artisan vendor:publish --tag=mettr-config) and add 'forms' => false to its track list.

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 the Laravel SDK's mettr.mcp middleware first on its route, before its auth:

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

Each call an AI assistant makes is an mcp.* event, and the route sends no crawl. More in MCP analytics.

Updated · This page as Markdown · Something unclear? [email protected]

Search the docs, features, comparisons, blog and changelog