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 Django, FastAPI and Flask

Live analytics for Python apps: middleware for Django, FastAPI, Starlette and Flask sends sign-ins, crawler visits, 404s, errors, response times and your events.

Install

pip install mettr

Python 3.10 or later, no dependencies.

Django

INSTALLED_APPS = [..., "mettr.django"]
MIDDLEWARE = [..., "mettr.django.MettrMiddleware"]
{% load mettr %}
<head>{% mettr_script %}</head>

FastAPI and Starlette

app.add_middleware(MettrMiddleware, mettr=Mettr())

Flask

mettr = MettrFlask(app)

What you get without writing code

  • Page views and who is online, from the browser script, served from /_live on your own domain, so ad blockers mostly let it through.
  • Sign-ins and sign-ups in Django, as login and signup; staff (is_staff) send nothing.
  • Crawler visits, with their page and status: only your server sees them.
  • 404s and exceptions, the latter by class only, never the message.
  • Response times of one request in twenty, by route.

Sync and async views alike. Events go from a background thread, never in the request's way.

Your own events

mettr.event("signup", {"plan": "pro"}, Visitor(user_id="42"))

Revenue from your own billing

Stripe, Paddle and Polar are read by mettr itself. Billing of your own? mettr.subscription() sends each subscription as it changes, and MRR, churn and revenue by source follow.

Open source

mettr is MIT licensed, on GitHub and PyPI. 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