Live analytics for Ruby on Rails
Live analytics for Rails and any Rack app: add the gem and see page views, Devise sign-ins, crawler visits, 404s, errors and your own events as they happen.
Add the gem
gem "mettr"
<head> <%= mettr_script_tag %> </head>
Set METTR_SECRET_KEY and METTR_PUBLIC_KEY: in Rails the middleware puts itself at the top of the stack and sends from production only. Sinatra, Roda and Hanami add Mettr::Rack. Ruby 3.2 or later, no dependencies.
What you get without writing code
- Page views and who is online, from the browser script, served from
/_liveon your own domain, so ad blockers mostly let it through. - Sign-ins through Devise, as
login. - Unhandled exceptions from Rails' error reporter, by class only, never the message.
- Crawler visits, with their page and status, and 404s of people.
- Response times of one request in twenty, by route.
Your own events
Mettr.event("signup", {plan: "pro"}, user_id: user.id)
During a request, an event carries its page, address and browser. Events go from a background thread, never in the request's way.
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
The mettr gem is MIT licensed, on GitHub and RubyGems. The full guide.
Read on
See your site live in two minutes
Free for one site. No card, no cookie banner