Phase 4 part 6: the dashboard, CSV exports and an open metrics page

The MRR page adds churn, CLV, CAC and CLV:CAC. Eight tables download as
CSV (MRR, NRR and revenue cohorts, CAC by month and channel, spend,
products, customers). Metrics → Publish builds an open metrics page from
chosen totals only (never a customer) and opens a pull request that adds
or updates it on the site, checked with a Hugo build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 13:28:50 -07:00
co-authored by Claude Opus 5.5
parent 23f765159f
commit 152c14b580
18 changed files with 637 additions and 5 deletions
+1
View File
@@ -56,6 +56,7 @@
<a href="/metrics/spend" {{if eq $nav "metrics/spend"}}aria-current="page"{{end}}>Spend and CAC</a>
<a href="/metrics/clv" {{if eq $nav "metrics/clv"}}aria-current="page"{{end}}>CLV and cohorts</a>
<a href="/metrics/customers" {{if eq $nav "metrics/customers"}}aria-current="page"{{end}}>Customers and the CRM</a>
<a href="/metrics/publish" {{if eq $nav "metrics/publish"}}aria-current="page"{{end}}>Publish</a>
</div>
{{end}}
{{if eq .ID "prospects"}}
+1
View File
@@ -33,5 +33,6 @@
{{if $d.Profit}}{{range .Margin}}<td class="num">{{if .Known}}{{usd .V}}{{end}}</td>{{end}}{{else}}{{range .PerCustomer}}<td class="num">{{if .Known}}{{usd .V}}{{end}}</td>{{end}}{{end}}
</tr>{{end}}</tbody>
</table></div>
<p class="small"><a href="/metrics/export/cohort-revenue.csv">Download as CSV</a> (every cohort, 24 months)</p>
{{end}}
{{end}}{{end}}
@@ -19,6 +19,7 @@
</div>
</section>
<p class="small"><a href="/metrics/export/customers.csv">Download every customer as CSV</a></p>
<nav class="tabs">
<a href="/metrics/customers" {{if eq .Show ""}}aria-current="page"{{end}}>To fix</a>
<a href="/metrics/customers?show=paying" {{if eq .Show "paying"}}aria-current="page"{{end}}>Paying now</a>
@@ -0,0 +1,23 @@
{{define "content"}}{{with .Data}}{{$o := .O}}
<div class="heading"><h1>Publish your metrics</h1></div>
<p class="lede">An "open metrics" page on your website: your revenue numbers, straight from billing, for customers and investors who like seeing a company's real numbers. Only totals are published, never anything about any one customer. It goes to the site as a pull request, like the SEO changes; merging publishes it. Open it again whenever you want the numbers updated.</p>
<form method="post" action="/metrics/publish" class="card">
<div class="cols">
<label>Website <select name="site">{{range .Sites}}<option value="{{.Index}}" {{if eq .Index $o.Site}}selected{{end}}>{{.URL}}</option>{{end}}</select></label>
<label>Address on the site <input name="path" value="{{$o.Path}}"></label>
</div>
<label>Title <input name="title" value="{{$o.Title}}"></label>
<fieldset><legend>What to show</legend>
{{range .Parts}}<label class="check"><input type="checkbox" name="part" value="{{.ID}}" {{if index $o.Parts .ID}}checked{{end}}> {{.Label}}</label>{{end}}
</fieldset>
<div class="actions">
<button type="submit" class="secondary" name="do" value="save">Save and preview</button>
<button type="submit" name="do" value="pr" data-busy="Opening…" {{if not .Gitea}}disabled title="Save a Gitea token under Settings → Search engines"{{end}}>Open a pull request</button>
</div>
{{with $o.PRURL}}<p class="small">Last opened {{ago $o.PRAt}}: <a href="{{.}}" target="_blank" rel="noopener noreferrer">the pull request ↗</a></p>{{end}}
</form>
<h2>Preview</h2>
{{if .Preview}}<pre class="sample">{{.Preview}}</pre>{{else}}<p class="help">There's no complete month of billing to publish yet.</p>{{end}}
{{end}}{{end}}
+3 -3
View File
@@ -9,7 +9,7 @@
<tbody>{{range .Months}}<tr><td>{{.Month}}</td><td class="num">{{if .Spend}}{{money .Spend}}{{else}}<span class="muted">·</span>{{end}}</td><td class="num">{{.New}}</td>
<td class="num">{{if .Spend}}{{cents .CAC}}{{else}}<span class="muted">no spend logged</span>{{end}}</td><td class="num">{{cents .Trailing3}}</td></tr>{{end}}</tbody>
</table></div>
<p class="help">One month's CAC swings with a handful of customers; the three-month figure is steadier.</p>
<p class="help">One month's CAC swings with a handful of customers; the three-month figure is steadier. <a href="/metrics/export/cac.csv">Download as CSV</a></p>
</section>
{{with .CAC.Channels}}
@@ -19,7 +19,7 @@
<thead><tr><th>Channel</th><th class="num">Spend</th><th class="num">New customers</th><th class="num">CAC</th></tr></thead>
<tbody>{{range .}}<tr><td>{{spendChannel .Channel}}</td><td class="num">{{money .Spend}}</td><td class="num">{{.New}}</td><td class="num">{{cents .CAC}}</td></tr>{{end}}</tbody>
</table>
<p class="help">{{if $d.CAC.Unknown}}{{$d.CAC.Unknown}} new customers had no step in the funnel before paying, so their channel is unknown. {{end}}General spend counts in the monthly CAC, not in any one channel's.</p>
<p class="help">{{if $d.CAC.Unknown}}{{$d.CAC.Unknown}} new customers had no step in the funnel before paying, so their channel is unknown. {{end}}General spend counts in the monthly CAC, not in any one channel's. <a href="/metrics/export/cac-channels.csv">Download as CSV</a></p>
</section>
{{end}}
@@ -42,7 +42,7 @@
</form>
{{if .Log}}
<h2>The log</h2>
<h2>The log <a class="small" href="/metrics/export/spend.csv">Download as CSV</a></h2>
<table class="list compact">
<thead><tr><th>Month</th><th>Channel</th><th class="num">Amount</th><th>Note</th><th>From</th><th></th></tr></thead>
<tbody>{{range .Log}}<tr><td>{{.Month}}</td><td>{{spendChannel .Channel}}</td><td class="num">{{money .AmountCents}}</td><td class="small">{{.Note}}</td><td class="small muted">{{.Source}}</td>
+11 -1
View File
@@ -27,6 +27,14 @@
<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}}
@@ -50,6 +58,7 @@
<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>
@@ -58,6 +67,7 @@
<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>{{range .Retained}}<td class="num">{{if ge . 0.0}}{{pct .}}{{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">
@@ -98,7 +108,7 @@
<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></div>
<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}}