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

Live analytics for your Node.js backend

Live analytics for Node.js, Bun, Deno and Workers: middleware for Express, Fastify and Hono sends crawler visits, 404s, errors, response times and your events.

One middleware

npm install @mettr/node
import { Mettr } from '@mettr/node';
import { mettrMiddleware } from '@mettr/node/express';

const mettr = new Mettr();

app.use(mettrMiddleware(mettr, { user: (req) => req.user?.id?.toString() }));

Fastify and Hono have theirs; anything that speaks fetch (Bun, Deno, Cloudflare Workers, Vercel's edge) wraps its handler in withMettr. It reads METTR_SECRET_KEY and METTR_PUBLIC_KEY, and sends only when NODE_ENV is production.

What it sends on its own

  • Crawler visits, with their page and status: search engines and AI crawlers seldom run the browser script, so only your server sees them.
  • 404s of people, as errors.
  • Exceptions, by their class only, never the message.
  • Response times of one request in twenty, by route.
  • The browser script, served from /_live on your own domain with mettr.scriptTag(): page views and who is online, past most ad blockers, each event carrying the visitor and user your server saw.

Your own events

mettr.event('signup', { plan: 'pro' }, { userId: '42' });

Events wait a second to go together and are sent off the request's path. Sending never throws into your app.

Revenue, history and deploys

Billing of your own? mettr.subscription() sends each subscription as it changes, and mettr works out MRR, churn and revenue by source. mettr.import() brings your history, and mettr.annotation() marks a deploy under the traffic chart.

Open source

@mettr/node is MIT licensed, on GitHub and npm, with no dependencies. The full guide.

See your site live in two minutes

Free for one site. No card, no cookie banner

Start free

Search the docs, features, comparisons, blog and changelog