Live analytics built for Laravel
Live analytics for Laravel apps: one composer require sends page views, your events, errors, sign-ins, failed jobs, response times and crawler visits, after the response has gone.
Three lines to install
mettr was built from dashboards that ran inside three Laravel sites, so Laravel is where it is most at home.
composer require mettr/laravel
METTR_SECRET_KEY=sk_... METTR_PUBLIC_KEY=pk_...
<head> @mettr </head>
It sends from production only, so local work and tests stay out of your numbers. PHP 8.3 or later, Laravel 12 or 13.
What you get without writing code
- Page views, navigation, outbound clicks and who is online, from the browser script, loaded and sent through
/_liveon your own domain, so ad blockers mostly leave it alone and each event carries the signed-in user. - Sign-ins and sign-ups, from Laravel's own
LoginandRegisteredevents. - 404s and exceptions, by class, never the message: a wave of 404s after a deploy shows up next to the deploy.
- Failed queue jobs, with the job, the queue and the exception's class.
- Response times of a sample of requests, for the slowest routes.
- Crawler visits: Googlebot, Bingbot, GPTBot, ClaudeBot and the rest, named, checked against their owners' networks where that can be done, kept apart from your visitors.
Your own events, in one line
use Mettr\Laravel\Facades\Mettr; Mettr::event('upgrade', ['plan' => 'pro', 'seats' => 5]);
Events are batched and sent after the response has gone, so a visitor never waits on mettr. In queue workers and console commands they go when the job or command ends; or send them through a queue of your own with METTR_QUEUE.
Leave your team out
Name a gate, and nothing is sent for the people it allows:
Gate::define('mettr-staff', fn (User $user): bool => $user->is_admin);
Bring your history
Already logging with spatie/laravel-activitylog? One command sends your history, a thousand rows a batch, each with its own id so a second run adds nothing twice:
php artisan mettr:import-activity-log --dry-run
Revenue from your own billing
Billing with Cashier or code of your own? Send each subscription as it changes, and MRR, churn and revenue by source follow:
Mettr::subscription(id: (string) $subscription->id, status: 'active', amount: 19.00, currency: 'USD', userId: (string) $user->id);
Open source
mettr/laravel is MIT licensed, on GitHub and Packagist. Read exactly what it sends: messages of exceptions, request bodies and headers other than the user agent never leave your server. The full guide.
Read on
See your site live in two minutes
Free for one site. No card, no cookie banner