Each cohort cell now gives what the same customers pay that month, in dollars, under the share of their starting MRR. The cohorts CSV adds month_N_mrr columns after the month_N_pct ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
116 lines
9.3 KiB
HTML
116 lines
9.3 KiB
HTML
{{define "content"}}{{with .Data}}
|
||
<div class="heading">
|
||
<h1>Metrics</h1>
|
||
{{if .Stripe}}<div class="buttons">
|
||
<form method="post" action="/metrics/sync" data-busy="Syncing…"><button type="submit" class="secondary">Sync now</button></form>
|
||
</div>{{end}}
|
||
</div>
|
||
<p class="lede">MRR and its movements, NRR, CAC and CLV, computed from your Stripe data: every customer, invoice, credit note and refund. MRR comes from the invoice lines (what each customer was billed, for which period), so past months are exact. Supermarket only reads Stripe.</p>
|
||
|
||
{{with .Now}}{{$d := $.Data}}
|
||
{{with $d.Model.Suggest}}
|
||
<section class="card">
|
||
<p class="warn-text">In {{.Month}}, {{.Customers}} customers ({{usd .MRR}} of MRR) appear in Stripe at once. That usually means billing moved to Stripe then, not that they all signed up that month. Counting from {{.Month}} makes them the starting base instead of new customers.</p>
|
||
<div class="row">
|
||
<form method="post" action="/metrics/start"><input type="hidden" name="month" value="{{.Month}}"><button type="submit" class="small">Count from {{.Month}}</button></form>
|
||
<form method="post" action="/metrics/start"><input type="hidden" name="month" value="all"><button type="submit" class="secondary small">Keep counting everything</button></form>
|
||
</div>
|
||
</section>
|
||
{{end}}
|
||
|
||
<section class="card">
|
||
<h2>MRR {{if .Partial}}<span class="muted small">today</span>{{else}}<span class="muted small">at the end of {{.Month}}</span>{{end}}</h2>
|
||
<div class="funnel">
|
||
<div class="step"><span class="label">MRR</span><strong>{{usd .MRR}}</strong><span class="rate">ARR {{usd (mul12 .MRR)}}</span></div>
|
||
<div class="step"><span class="label">Paying customers</span><strong>{{num .Customers}}</strong></div>
|
||
<div class="step"><span class="label">Average per customer</span><strong>{{usd .ARPA}}</strong></div>
|
||
<div class="step"><span class="label">NRR, this month</span><strong>{{pct .NRR}}</strong><span class="rate">of last month's MRR kept</span></div>
|
||
<div class="step"><span class="label">NRR, 12 months</span><strong>{{pct .NRR12}}</strong><span class="rate">what customers of a year ago pay now</span></div>
|
||
</div>
|
||
{{with $d.CLV}}
|
||
<div class="funnel">
|
||
<div class="step"><span class="label">Churn</span><strong>{{dec1f .Churn}}%</strong><span class="rate">of customers a month</span></div>
|
||
<div class="step"><span class="label">CLV</span><strong>{{cents .Value}}</strong><span class="rate">gross profit per customer</span></div>
|
||
<div class="step"><span class="label">CAC</span><strong>{{cents .CAC}}</strong><span class="rate">{{if lt .CAC 0.0}}<a href="/metrics/spend">log spend</a>{{else}}12 months{{end}}</span></div>
|
||
<div class="step"><span class="label">CLV : CAC</span><strong>{{if ge .Ratio 0.0}}{{dec1f .Ratio}} : 1{{else}}·{{end}}</strong></div>
|
||
</div>
|
||
{{end}}
|
||
{{with $d.Bars}}
|
||
<svg class="chart" viewBox="0 0 600 170" role="img" aria-label="MRR by month">
|
||
{{range .}}<rect x="{{.X}}" y="{{.Y}}" width="{{.W}}" height="{{.H}}"><title>{{.Month}}: {{usd .MRR}}</title></rect>{{if .Label}}<text x="{{.X}}" y="166">{{.Month}}</text>{{end}}{{end}}
|
||
</svg>
|
||
{{end}}
|
||
<p class="small muted">From the invoice lines of paid invoices (an unpaid one counts once it's paid), in {{$d.Model.Currency}}: each recurring line's amount after discounts, spread over its billing period. Trials ($0), one-off charges, void and uncollectible invoices don't count. A customer whose first invoice in Stripe is a renewal was a customer already: that first payment counts as reactivation, not new, and puts them in no cohort.{{with $d.Model.Start}}{{if ne . "all"}} Counted from {{.}}.{{end}}{{end}}</p>
|
||
</section>
|
||
|
||
<h2>Month by month</h2>
|
||
<div class="table-wrap"><table class="list compact">
|
||
<thead><tr><th>Month</th><th class="num">MRR</th><th class="num">Customers</th><th class="num">Net change</th><th class="num">NRR</th><th class="num">New</th><th class="num">Expansion</th><th class="num">Contraction</th><th class="num">Churn</th><th class="num">Reactivation</th></tr></thead>
|
||
<tbody>{{range $d.Recent}}<tr>
|
||
<td><a href="/metrics/month/{{.Month}}">{{.Month}}</a>{{if .Partial}} <span class="muted small">so far</span>{{end}}</td>
|
||
<td class="num">{{usd .MRR}}</td><td class="num">{{num .Customers}}</td>
|
||
<td class="num"><strong>{{usd .NetNew}}</strong></td>
|
||
<td class="num">{{pct .NRR}}</td>
|
||
<td class="num">{{if .New}}{{usd .New}} <span class="muted small">({{.NewCount}})</span>{{else}}<span class="muted">·</span>{{end}}</td>
|
||
<td class="num">{{if .Expansion}}{{usd .Expansion}}{{else}}<span class="muted">·</span>{{end}}</td>
|
||
<td class="num">{{if .Contraction}}−{{usd .Contraction}}{{else}}<span class="muted">·</span>{{end}}</td>
|
||
<td class="num">{{if .Churn}}−{{usd .Churn}} <span class="muted small">({{.ChurnCount}})</span>{{else}}<span class="muted">·</span>{{end}}</td>
|
||
<td class="num">{{if .Reactivation}}{{usd .Reactivation}}{{else}}<span class="muted">·</span>{{end}}</td>
|
||
</tr>{{end}}</tbody>
|
||
</table></div>
|
||
<p class="small"><a href="/metrics/export/mrr.csv">Download as CSV</a> (every month)</p>
|
||
|
||
{{if $d.Cohorts}}
|
||
<h2>Cohorts</h2>
|
||
<p class="help">Customers by the month they first paid, and what those same customers pay each month after: the share of their starting MRR (above 100% means they grew), and below it the dollars.</p>
|
||
<div class="table-wrap"><table class="list compact cohorts">
|
||
<thead><tr><th>First paid</th><th class="num">Customers</th><th class="num">Starting MRR</th>{{range $i, $_ := $d.Span}}<th class="num">{{$i}}</th>{{end}}</tr></thead>
|
||
<tbody>{{range $d.Cohorts}}<tr><td>{{.Month}}</td><td class="num">{{.Customers}}</td><td class="num">{{usd .Start}}</td>{{$co := .}}{{range $k, $r := .Retained}}<td class="num">{{if ge $r 0.0}}{{pct $r}}<br><span class="muted small">{{usd (index $co.MRR $k)}}</span>{{end}}</td>{{end}}</tr>{{end}}</tbody>
|
||
</table></div>
|
||
<p class="small"><a href="/metrics/export/nrr-cohorts.csv">Download as CSV</a> (every cohort, 24 months)</p>
|
||
{{end}}
|
||
|
||
<form method="post" action="/metrics/start" class="row small">
|
||
<label class="small">Count from <input name="month" value="{{with $d.Model.Start}}{{if ne . "all"}}{{.}}{{end}}{{end}}" placeholder="YYYY-MM, empty for everything" size="12"></label>
|
||
<button type="submit" class="secondary small">Save</button>
|
||
</form>
|
||
{{end}}
|
||
|
||
<section class="card">
|
||
<h2>Stripe</h2>
|
||
{{if not .Stripe}}
|
||
<p class="warn-text">Save a restricted Stripe key under <a href="/settings/tracking#stripe">Settings → Website & sales</a>. For the metrics it needs read access to Customers, Invoices, Credit notes, Charges and Refunds, and Events, on top of Checkout Sessions.</p>
|
||
{{else}}
|
||
{{with .Last}}
|
||
<p class="small {{if .Error}}error-text{{else}}muted{{end}}">Synced {{ago .At}}{{if .Full}} (everything read){{else}} ({{.Events}} changes since the last sync){{end}}{{with .Error}}: {{.}}{{end}}.{{with .Currency}} Currencies: {{range $i, $c := .}}{{if $i}}, {{end}}{{$c}}{{end}}.{{end}}</p>
|
||
{{else}}<p class="help">Not synced yet: the first sync reads all your Stripe history, which can take a few minutes.</p>{{end}}
|
||
<div class="funnel">
|
||
<div class="step"><span class="label">Customers</span><strong>{{num .Spenders}}</strong><span class="rate">spent more than $0, of {{num (or (index .Counts "customer") 0)}} in Stripe</span></div>
|
||
<div class="step"><span class="label">Payments</span><strong>{{num (or (index .Counts "charge") 0)}}</strong></div>
|
||
<div class="step"><span class="label">Invoices</span><strong>{{num (or (index .Counts "invoice") 0)}}</strong></div>
|
||
<div class="step"><span class="label">Credit notes</span><strong>{{num (or (index .Counts "credit_note") 0)}}</strong></div>
|
||
<div class="step"><span class="label">Refunds</span><strong>{{num (or (index .Counts "refund") 0)}}</strong></div>
|
||
</div>
|
||
<form method="post" action="/metrics/sync" data-busy="Reading everything…" class="inline"><input type="hidden" name="full" value="1"><button type="submit" class="link small">Read everything again</button></form>
|
||
{{with .Last}}{{range .Notes}}<p class="small muted">{{.}}</p>{{end}}{{end}}
|
||
{{end}}
|
||
</section>
|
||
|
||
{{if .Products}}{{$m := .Margins}}
|
||
<form method="post" action="/metrics/margins" class="card" id="margins">
|
||
<h2>Gross margin by product</h2>
|
||
<p class="small">What you keep of each dollar a product brings in, after what it costs you to deliver (hosting, licences, support). CLV weighs each customer's revenue by the margin of what they buy. An empty box uses the default.</p>
|
||
<label>Default <input name="default" value="{{$m.Default}}" inputmode="decimal" size="5"> %</label>
|
||
<table class="list">
|
||
<thead><tr><th>Product</th><th class="num">Billed, last 12 months</th><th class="num">Invoices</th><th class="num">Margin</th></tr></thead>
|
||
<tbody>{{range .Products}}<tr>
|
||
<td>{{.Name}}{{if and .ID (ne .Name .ID)}} <span class="muted small">{{.ID}}</span>{{end}}</td>
|
||
<td class="num">{{money .Revenue}}</td><td class="num">{{num .Invoices}}</td>
|
||
<td class="num">{{if .ID}}<input name="margin:{{.ID}}" value="{{if .Own}}{{.Margin}}{{end}}" placeholder="{{$m.Default}}" inputmode="decimal" size="5"> %{{else}}<span class="muted">default</span>{{end}}</td>
|
||
</tr>{{end}}</tbody>
|
||
</table>
|
||
<div class="actions"><button type="submit">Save margins</button> <a class="small" href="/metrics/export/products.csv">Download as CSV</a></div>
|
||
</form>
|
||
{{end}}
|
||
{{end}}{{end}}
|