Phase 4 part 2: MRR, its movements, NRR and cohorts
Each customer's MRR at each month's end, from the recurring lines of paid and open invoices: the amount after discounts over the billing interval, prorations over their part-period. Moves are new, expansion, contraction, churn and reactivation (sub-dollar noise ignored); NRR monthly and over 12 months; cohorts by first paid month. A start month, suggested when most of the business appears at once (billing moved to Stripe), makes those customers the base. Metrics page with a chart, the month table, cohorts, and each month's customer moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -7,6 +7,7 @@ import (
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"log/slog"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -162,6 +163,8 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
mux.HandleFunc("GET /metrics", s.metricsPage)
|
||||
mux.HandleFunc("POST /metrics/sync", s.metricsSync)
|
||||
mux.HandleFunc("POST /metrics/margins", s.metricsMargins)
|
||||
mux.HandleFunc("POST /metrics/start", s.metricsStart)
|
||||
mux.HandleFunc("GET /metrics/month/{month}", s.metricsMonth)
|
||||
mux.HandleFunc("GET /seo", s.seoPage)
|
||||
mux.HandleFunc("GET /seo/check", s.seoCheckPage)
|
||||
mux.HandleFunc("GET /seo/engines", s.seoEnginesPage)
|
||||
@@ -305,7 +308,17 @@ func (s *Server) loadTemplates() error {
|
||||
},
|
||||
"xreserve": twitter.URLReserve,
|
||||
// money shows cents as dollars: $1,234 or $12.50.
|
||||
"money": money,
|
||||
"money": money,
|
||||
// usd shows float cents as whole dollars: $9,835.
|
||||
"usd": func(cents float64) string { return money(int64(math.Round(cents/100)) * 100) },
|
||||
"mul12": func(f float64) float64 { return 12 * f },
|
||||
"sub": func(a, b float64) float64 { return a - b },
|
||||
"pct": func(f float64) string {
|
||||
if f < 0 {
|
||||
return "·"
|
||||
}
|
||||
return strconv.FormatFloat(f, 'f', 0, 64) + "%"
|
||||
},
|
||||
"num": seo.Thousands,
|
||||
"cls": func(x100 int) float64 { return float64(x100) / 100 },
|
||||
"dec1": func(f float64) string { return strconv.FormatFloat(f, 'f', 1, 64) },
|
||||
|
||||
Reference in New Issue
Block a user