<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 牛云鹏</title>
    <description>The latest articles on DEV Community by 牛云鹏 (@optimetricshub).</description>
    <link>https://dev.to/optimetricshub</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4195273%2F7ae5801e-1800-4bf1-97cd-a741e61dc6a0.png</url>
      <title>DEV Community: 牛云鹏</title>
      <link>https://dev.to/optimetricshub</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/optimetricshub"/>
    <language>en</language>
    <item>
      <title>Shipping an Embeddable Calculator With No Script Tag, No API and No Build</title>
      <dc:creator>牛云鹏</dc:creator>
      <pubDate>Mon, 26 Oct 2026 03:49:48 +0000</pubDate>
      <link>https://dev.to/optimetricshub/shipping-an-embeddable-calculator-with-no-script-tag-no-api-and-no-build-2624</link>
      <guid>https://dev.to/optimetricshub/shipping-an-embeddable-calculator-with-no-script-tag-no-api-and-no-build-2624</guid>
      <description>&lt;p&gt;Every "add our widget to your site" instruction has quietly become the same thing: paste this &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, load 180 KB of framework, and let us run code in your page.&lt;/p&gt;

&lt;p&gt;For a calculator that takes four numbers and does multiplication, that is a bad trade. Here is the version we ship instead, and why each decision went the way it did.&lt;/p&gt;

&lt;h2&gt;
  
  
  One iframe, no script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;iframe&lt;/span&gt;
  &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://optimetricshub.com/embed/churn"&lt;/span&gt;
  &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Churn Rate Calculator"&lt;/span&gt;
  &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"100%"&lt;/span&gt;
  &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"700"&lt;/span&gt;
  &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"border:1px solid #e2e8f0;border-radius:12px"&lt;/span&gt;
  &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No script tag, no global object, no postMessage handshake, no CORS configuration, nothing added to the embedding page's bundle. The iframe is same-origin to us and cross-origin to you, which means the browser does the isolation for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not a script tag
&lt;/h2&gt;

&lt;p&gt;A script tag needs an iframe anyway if you want real isolation. Once you have a &lt;code&gt;&amp;lt;script src&amp;gt;&lt;/code&gt; on a third-party page you have inherited:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global namespace collisions.&lt;/strong&gt; Two analytics widgets both defining &lt;code&gt;window.__widget&lt;/code&gt; is a support ticket nobody can reproduce.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSS bleed.&lt;/strong&gt; Any stylesheet you inject affects the host page. Shadow DOM fixes it, but then you are shipping the shadow-DOM polyfill or accepting a browser floor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A build to maintain.&lt;/strong&gt; The script is a separate artefact from the page it mirrors, so formulas drift between your site and your embed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consent and privacy review.&lt;/strong&gt; A script that reads &lt;code&gt;document.cookie&lt;/code&gt; on someone else's domain is a legal conversation. An iframe with no storage access is not.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The iframe avoids all four, and costs one extra HTTP request that &lt;code&gt;loading="lazy"&lt;/code&gt; mostly defers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the arithmetic runs client-side
&lt;/h2&gt;

&lt;p&gt;The calculator does not post the numbers anywhere. It computes in the browser and renders the result, which means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No backend to scale.&lt;/strong&gt; A traffic spike costs nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No data-retention question.&lt;/strong&gt; We cannot lose what we never receive, and the host page's privacy policy does not have to account for us.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant results.&lt;/strong&gt; No round trip between keystroke and answer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trade-off is that the formulas ship to the reader. For a churn or runway calculator that is not a secret worth protecting — the formula is the product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sizing without a scrollbar
&lt;/h2&gt;

&lt;p&gt;The annoying part of iframes is height. A frame that is 40 px too short produces a scrollbar inside a page that already scrolls, which reads as broken.&lt;/p&gt;

&lt;p&gt;Two options, in order of preference:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fixed heights per embed.&lt;/strong&gt; Each calculator has a documented height that is slightly above its real content height. It is boring and it never breaks: no JS, no layout shift, no race between content and resize.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;postMessage&lt;/code&gt; + &lt;code&gt;ResizeObserver&lt;/code&gt;.&lt;/strong&gt; Send the content height from inside the frame and set the iframe height on the host. Correct and adaptive, but it needs a script on the host page — which is the thing we were avoiding.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We document fixed heights because option 2 undoes the whole design. The heights are in the &lt;a href="https://optimetricshub.com/embeds" rel="noopener noreferrer"&gt;embed catalogue&lt;/a&gt;, along with the snippet for each calculator.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that is actually load-bearing
&lt;/h2&gt;

&lt;p&gt;The frame contains a visible link back to the full tool page. That link is the entire business model: the calculators are free, there is no signup, and the only requirement for embedding is that the attribution stays.&lt;/p&gt;

&lt;p&gt;This is also why the embed pages are &lt;code&gt;noindex&lt;/code&gt;. An embedded copy of a calculator that got indexed would compete with the canonical tool page for the same query, and the site would be cannibalising itself from the inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we gave up
&lt;/h2&gt;

&lt;p&gt;A widget with &lt;code&gt;postMessage&lt;/code&gt; can do things an iframe cannot: push a result into the host page's form, react to the host's theme, participate in the host's state. If you are building a chart library, use a script. If you are building a calculator that takes four numbers, the iframe wins on every axis that matters.&lt;/p&gt;

&lt;p&gt;The three free calculators most likely to be useful in a docs page or a course:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://optimetricshub.com/tools/churn-calculator" rel="noopener noreferrer"&gt;Churn rate calculator&lt;/a&gt; — customer and revenue churn, plus a 12-month compounding projection&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://optimetricshub.com/tools/cac-payback-calculator" rel="noopener noreferrer"&gt;CAC payback calculator&lt;/a&gt; — months to recover acquisition cost&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://optimetricshub.com/tools/runway-calculator" rel="noopener noreferrer"&gt;Runway calculator&lt;/a&gt; — net burn, runway, zero-cash date&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All six are listed together, with copy-paste snippets, at &lt;a href="https://optimetricshub.com/embeds" rel="noopener noreferrer"&gt;optimetricshub.com/embeds&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>privacy</category>
    </item>
    <item>
      <title>The Five SaaS Metrics Worth Agreeing On (and How to Compute Each One)</title>
      <dc:creator>牛云鹏</dc:creator>
      <pubDate>Mon, 26 Oct 2026 02:57:42 +0000</pubDate>
      <link>https://dev.to/optimetricshub/the-five-saas-metrics-worth-agreeing-on-and-how-to-compute-each-one-m9o</link>
      <guid>https://dev.to/optimetricshub/the-five-saas-metrics-worth-agreeing-on-and-how-to-compute-each-one-m9o</guid>
      <description>&lt;p&gt;Every early-stage SaaS founder I have talked to tracks too many numbers and trusts too few of them. The problem is rarely the dashboard. It is that each metric is computed slightly differently by whoever built the sheet, so two people in the same company quote different churn figures in the same meeting.&lt;/p&gt;

&lt;p&gt;This is the short list I would keep if I had to defend it: five numbers, each with one formula, each answering a question the others cannot.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Growth efficiency: the CAC payback period
&lt;/h2&gt;

&lt;p&gt;Payback answers "how long until this customer has repaid what it cost to win them" and it is the metric that decides whether growth is self-funding or funded by the bank.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CAC payback (months) = CAC / (ARPU × gross margin)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things break it. Using revenue instead of gross profit understates payback by the margin: at 80% margin, $100 of ARPU is $80 of contribution, so payback is 25% longer than the naive version. And including only ad spend in CAC — not salaries, tools, or sales commissions — understates the denominator by a factor of two or three in a sales-led business.&lt;/p&gt;

&lt;p&gt;Under 12 months is the usual target for SMB; 18–24 months is normal for mid-market. If it is over 24 and you are not venture-funded, the growth is being paid for out of the bank account.&lt;/p&gt;

&lt;p&gt;The full method, including how to handle a blended versus paid-only CAC, is in the &lt;a href="https://optimetricshub.com/guides/cac-payback-period" rel="noopener noreferrer"&gt;CAC payback period guide&lt;/a&gt;. The denominator is worth its own read: &lt;a href="https://optimetricshub.com/guides/cac-formula" rel="noopener noreferrer"&gt;how CAC is defined&lt;/a&gt; changes more outcomes than the payback arithmetic does.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Unit economics: the LTV:CAC ratio
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LTV   = ARPU × gross margin × (1 / monthly churn)
ratio = LTV / CAC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three times is the line, and it survives because below it every new customer is financed from cash. Above 5x, the usual explanation is underinvestment in acquisition rather than unusual efficiency — which is a problem, just a different one.&lt;/p&gt;

&lt;p&gt;The single most common error is computing LTV on revenue instead of gross profit. At 50% margin that doubles the ratio; at 80% margin it inflates it by 25%. Two companies with identical economics can appear to have completely different unit economics purely because one skipped the margin term.&lt;/p&gt;

&lt;p&gt;Benchmarks by segment, and the reasons the ratio moves, are laid out in the &lt;a href="https://optimetricshub.com/guides/good-ltv-cac-ratio" rel="noopener noreferrer"&gt;LTV:CAC ratio reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Retention: net revenue retention
&lt;/h2&gt;

&lt;p&gt;Gross churn tells you what left. NRR tells you what the base did including expansion, contraction and cancellations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NRR = (starting MRR + expansion − contraction − churn) / starting MRR × 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above 100% means the existing customer base grows with zero new sales — the strongest single signal in SaaS, and the reason enterprise businesses can grow while losing accounts. Below 90% means you are running to stay in place.&lt;/p&gt;

&lt;p&gt;Report NRR and GRR (gross revenue retention) together. NRR alone hides how much retention is being propped up by upsells to a shrinking base. The distinction, and the formula in full, is in the &lt;a href="https://optimetricshub.com/guides/net-revenue-retention" rel="noopener noreferrer"&gt;net revenue retention breakdown&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Reporting hygiene: MRR versus ARR
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MRR = monthly recurring revenue, normalized
ARR = MRR × 12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The trap is not the multiplication. It is what counts as recurring: implementation fees, one-off onboarding, overage, and annual contracts billed upfront all get misclassified, and each one changes both MRR and every ratio built on top of it. Annual contract values divided by twelve is the standard; anything else needs to be stated explicitly.&lt;/p&gt;

&lt;p&gt;The normalization rules — including what to do with discounts, credits and mid-month upgrades — are covered in &lt;a href="https://optimetricshub.com/guides/mrr-vs-arr" rel="noopener noreferrer"&gt;MRR vs ARR&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Solvency: the budget line
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;runway (months) = cash / net monthly burn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where net burn is cash out minus cash in, and cash in means collections, not bookings. A company with strong bookings and slow collection can run out of money while reporting record revenue. Three months of runway is not a plan; eighteen is the point at which you can make multi-quarter decisions.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://optimetricshub.com/guides/startup-runway" rel="noopener noreferrer"&gt;startup runway guide&lt;/a&gt; covers gross versus net burn and how a single large annual prepayment distorts both.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you want one composite number
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://optimetricshub.com/guides/saas-quick-ratio" rel="noopener noreferrer"&gt;SaaS quick ratio&lt;/a&gt; collapses growth and retention into one figure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;quick ratio = (new MRR + expansion MRR) / (churned MRR + contraction MRR)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above 4 is healthy, 2–4 is workable, below 2 means growth is being offset by losses. It is the fastest sanity check on a dashboard that otherwise looks fine.&lt;/p&gt;

&lt;h2&gt;
  
  
  The meta-problem: nobody agrees on the benchmarks
&lt;/h2&gt;

&lt;p&gt;Most "healthy" thresholds circulating in pitch decks trace back to a handful of vendor surveys with different sample definitions. That is why a churn rate of 3% is excellent for one segment and alarming for another — and why comparing your number to a table without checking the segment is close to meaningless.&lt;/p&gt;

&lt;p&gt;I keep a &lt;a href="https://optimetricshub.com/benchmarks" rel="noopener noreferrer"&gt;SaaS metrics benchmarks page&lt;/a&gt; that states the segment and source next to each band, precisely because the segments are what make the numbers comparable at all.&lt;br&gt;
The same bands are also downloadable as a single file — 25 rows, each with the metric, segment, typical and best band, unit and definition, CC BY 4.0 and no signup: &lt;a href="https://optimetricshub.com/benchmarks/dataset" rel="noopener noreferrer"&gt;SaaS benchmark dataset&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;None of this is complicated arithmetic. The work is in the definitions, and in picking one definition per metric and writing it down where everyone can see it. Five formulas, agreed once, save a surprising number of meetings.&lt;/p&gt;

</description>
      <category>saas</category>
      <category>startup</category>
      <category>analytics</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Your SaaS metrics are probably right and still misleading</title>
      <dc:creator>牛云鹏</dc:creator>
      <pubDate>Mon, 26 Oct 2026 02:14:12 +0000</pubDate>
      <link>https://dev.to/optimetricshub/your-saas-metrics-are-probably-right-and-still-misleading-16e4</link>
      <guid>https://dev.to/optimetricshub/your-saas-metrics-are-probably-right-and-still-misleading-16e4</guid>
      <description>&lt;p&gt;Most SaaS metric arguments are not disagreements about the arithmetic. They are disagreements about which definition was used. Two people can look at the same spreadsheet, both be correct, and still quote CAC numbers that differ by 40%.&lt;/p&gt;

&lt;p&gt;Here are the three definitions that cause the most damage, and how to pin them down before anyone quotes a ratio.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. CAC: blended, paid, or fully loaded?
&lt;/h2&gt;

&lt;p&gt;Customer acquisition cost is sales and marketing spend divided by new customers. The division is easy. The two halves are where it goes wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blended CAC&lt;/strong&gt; uses total S&amp;amp;M spend over all new customers, including the ones who arrived through word of mouth, organic search, or a partner. It answers "what does growth cost us overall" and it is the number a CFO usually wants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Paid CAC&lt;/strong&gt; uses only paid acquisition spend over only the customers attributed to paid channels. It answers "is this channel working" and it is the number a growth team usually wants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fully loaded CAC&lt;/strong&gt; adds the costs most teams leave out: sales tooling, the SDR team's salaries, onboarding engineers if they are dedicated to new logos, and any commission that has not been paid yet. It can be 20–50% higher than the blended figure at companies with heavy sales-assisted motion.&lt;/p&gt;

&lt;p&gt;None of these is wrong. Quoting one while the other person assumes another is the bug. The fix is boring and effective: write the definition at the top of the model, and never compare your blended CAC to a benchmark that was computed on a paid basis.&lt;/p&gt;

&lt;p&gt;If you want the full breakdown, including which time period the spend should cover, there is a longer walkthrough here: &lt;a href="https://optimetricshub.com/guides/cac-formula" rel="noopener noreferrer"&gt;how to calculate CAC without three different answers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. ARPU: which denominator, and what counts as revenue?
&lt;/h2&gt;

&lt;p&gt;ARPU is revenue divided by users. Both halves are ambiguous.&lt;/p&gt;

&lt;p&gt;Take a product with 10,000 monthly active users, of whom 800 pay. MRR is $32,000.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Revenue per &lt;strong&gt;active user&lt;/strong&gt;: $3.20&lt;/li&gt;
&lt;li&gt;Revenue per &lt;strong&gt;paying user&lt;/strong&gt; (this is ARPPU): $40&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are not two estimates of the same thing. They answer different questions. ARPU is useful for a freemium funnel and for capacity planning. ARPPU is useful for pricing. Reporting ARPPU and calling it ARPU usually inflates the number by an order of magnitude and makes every benchmark comparison meaningless.&lt;/p&gt;

&lt;p&gt;The numerator is just as slippery. Do you include one-time setup fees, overage charges, professional services, or a prepaid annual plan booked in a single month? The usual convention is to normalise recurring revenue to a monthly basis and keep non-recurring revenue out, because including it makes ARPU spike in the month the contract lands and then fall back.&lt;/p&gt;

&lt;p&gt;I wrote the per-plan and per-region version of this, including what to do when a customer moves between plans mid-month, in &lt;a href="https://optimetricshub.com/guides/arpu-formula" rel="noopener noreferrer"&gt;the ARPU formula guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Gross margin: what is actually inside COGS?
&lt;/h2&gt;

&lt;p&gt;This one decides whether every downstream metric is right. LTV is built on gross margin, CAC payback is built on gross margin, and the Rule of 40 comparison is only fair if margin is defined consistently.&lt;/p&gt;

&lt;p&gt;A defensible SaaS COGS usually contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hosting and infrastructure&lt;/li&gt;
&lt;li&gt;third-party APIs and data costs the product cannot run without&lt;/li&gt;
&lt;li&gt;payment processing fees&lt;/li&gt;
&lt;li&gt;support and customer success staff who serve existing customers&lt;/li&gt;
&lt;li&gt;the delivery/implementation cost, if it is recurring rather than a one-off services line&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It usually does not contain R&amp;amp;D, sales, or marketing. The tricky boundary is support: if the same people handle pre-sales questions and post-sale tickets, you need an allocation rule, and you need to keep it constant across periods or your margin trend becomes an artefact of reclassification.&lt;/p&gt;

&lt;p&gt;A 75–80% gross margin is a common target for SaaS, but the benchmark is worthless if half the companies in it book customer support under operating expenses. The COGS boundary discussion is in &lt;a href="https://optimetricshub.com/guides/saas-gross-margin" rel="noopener noreferrer"&gt;SaaS gross margin, defined&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this compounds
&lt;/h2&gt;

&lt;p&gt;Change the definition of CAC and gross margin together and CAC payback can move by a factor of two:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Assumption&lt;/th&gt;
&lt;th&gt;CAC&lt;/th&gt;
&lt;th&gt;Margin&lt;/th&gt;
&lt;th&gt;Payback&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Blended CAC, fixed $40/mo ARPU, 80% margin&lt;/td&gt;
&lt;td&gt;$1,200&lt;/td&gt;
&lt;td&gt;80%&lt;/td&gt;
&lt;td&gt;37.5 months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fully loaded CAC (+30%), same ARPU and margin&lt;/td&gt;
&lt;td&gt;$1,560&lt;/td&gt;
&lt;td&gt;80%&lt;/td&gt;
&lt;td&gt;48.8 months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fully loaded CAC, 65% margin after support reclass&lt;/td&gt;
&lt;td&gt;$1,560&lt;/td&gt;
&lt;td&gt;65%&lt;/td&gt;
&lt;td&gt;60 months&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Same company. Same quarter. Three very different conclusions about whether the growth engine is efficient. Only one of them is comparable to a public benchmark, and you cannot tell which one from the slide.&lt;/p&gt;

&lt;p&gt;That is why it is worth fixing the definitions before drawing the chart. I keep a free &lt;a href="https://optimetricshub.com/tools/ltv-cac-calculator" rel="noopener noreferrer"&gt;LTV:CAC calculator&lt;/a&gt; that shows blended and fully loaded side by side, precisely so the gap is visible instead of hidden. There is also a longer &lt;a href="https://optimetricshub.com/guides/cac-payback-period" rel="noopener noreferrer"&gt;CAC payback period guide&lt;/a&gt; if you want to see how the month boundaries are handled.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short checklist
&lt;/h2&gt;

&lt;p&gt;Before quoting any SaaS ratio, write down four things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Which acquisition cost basis (blended / paid / fully loaded)&lt;/li&gt;
&lt;li&gt;Which denominator for ARPU (active users or paying accounts)&lt;/li&gt;
&lt;li&gt;What is inside COGS, especially support&lt;/li&gt;
&lt;li&gt;Which period the spend covers relative to the revenue it produced&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If those four lines are in the model, most metric arguments disappear. If they are not, the argument is not about the numbers at all — it is about the definitions, and it will happen again next month.&lt;/p&gt;

&lt;p&gt;If runway and burn rate are also on your plate, the same "which definition" problem applies there, and &lt;a href="https://optimetricshub.com/guides/burn-rate-formula" rel="noopener noreferrer"&gt;the burn rate formula breakdown&lt;/a&gt; covers net vs gross burn and why the denominator changes the answer.&lt;/p&gt;

</description>
      <category>saas</category>
      <category>startup</category>
      <category>analytics</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Three SaaS metrics that never make the dashboard</title>
      <dc:creator>牛云鹏</dc:creator>
      <pubDate>Tue, 20 Oct 2026 04:34:01 +0000</pubDate>
      <link>https://dev.to/optimetricshub/three-saas-metrics-that-never-make-the-dashboard-1jki</link>
      <guid>https://dev.to/optimetricshub/three-saas-metrics-that-never-make-the-dashboard-1jki</guid>
      <description>&lt;p&gt;Every SaaS dashboard shows MRR, churn and CAC payback. Three metrics that explain far more about where a business is actually going almost never appear, because each one needs a definition agreed before it means anything: net revenue retention, the Rule of 40, and the magic number.&lt;/p&gt;

&lt;p&gt;Here is each one, and the specific way it gets quietly corrupted.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Net revenue retention — the denominator is the whole metric
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NRR = revenue from the starting cohort today ÷ revenue from the same cohort at period start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above 100% means the existing base grows without a single new customer. Below 100% means you must win new business just to stand still.&lt;/p&gt;

&lt;p&gt;Two variants, and you should report both:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;NRR&lt;/th&gt;
&lt;th&gt;GRR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Expansion included&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can exceed 100%&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Answers&lt;/td&gt;
&lt;td&gt;is the base compounding?&lt;/td&gt;
&lt;td&gt;how much leaks out?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A company at 115% NRR and 82% GRR is growing its base while losing nearly a fifth of it every year. That dependency on continued upsell is invisible if you only quote NRR.&lt;/p&gt;

&lt;p&gt;The corruption is almost always the cohort. New customers signed during the period must be excluded from &lt;strong&gt;both&lt;/strong&gt; numerator and denominator. A customer who signed in March and bought more in June is a new logo expanding, not retention.&lt;/p&gt;

&lt;p&gt;The other two inflators: a list price rise applied across the base (real revenue, but it does not recur next year), and non-recurring revenue sitting in the starting base — professional services, onboarding fees, usage overage. Compute on recurring revenue only.&lt;/p&gt;

&lt;p&gt;Implementation, if you have customer id / plan / MRR per month:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;cohort&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;t0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mrr &amp;gt; 0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;denom&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cohort&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;num&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;t0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cohort&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)].&lt;/span&gt;&lt;span class="n"&gt;mrr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;nrr&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;denom&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do this for twelve monthly cohorts and average. A single window picks up whatever renewal cycle happened to land inside it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Rule of 40 — the margin definition is the argument
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;score = revenue growth rate (%) + profit margin (%)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;30% growth with a 10% margin passes. So does 10% growth with a 30% margin. That is the point: it encodes a trade-off rather than demanding both.&lt;/p&gt;

&lt;p&gt;The ambiguity is "margin". Free cash flow margin is the original public-company definition and the hardest to flatter. EBITDA margin is the most common. Operating margin is stricter. Whichever you pick, keep it — switching definitions between periods moves the score by more than most operational improvements do.&lt;/p&gt;

&lt;p&gt;What the score does not tell you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It punishes deliberate investment.&lt;/strong&gt; Hiring a sales team ahead of demand scores badly this year and well next year.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It treats all growth as equal.&lt;/strong&gt; 25% growth at 110% NRR is a compounding base; 25% at 75% NRR is a treadmill. Same score.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Small numbers distort it.&lt;/strong&gt; Below roughly $1m ARR the percentages are noise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It ignores capital efficiency.&lt;/strong&gt; Growth bought with $3 of equity per $1 of ARR passes the rule and destroys returns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use it as one of four signals, alongside NRR/GRR, CAC payback and runway. A company can pass the Rule of 40 and be nine months from insolvency if its cash conversion is poor.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Magic number — the lag is doing all the work
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;magic = (ARR this quarter − ARR last quarter) ÷ S&amp;amp;M spend last quarter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above 0.75 is considered efficient enough to increase spend. Below 0.5 means acquisition is not paying back fast enough to justify more.&lt;/p&gt;

&lt;p&gt;Three details decide whether the number means anything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Net new ARR includes churn.&lt;/strong&gt; Using gross new business makes any retention problem disappear — exactly the failure the metric exists to catch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full S&amp;amp;M cost.&lt;/strong&gt; Salaries, commissions, ads, tools, agencies. Excluding salaries inflates it, often by 2x.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The lag.&lt;/strong&gt; One quarter is convention. If your sales cycle is nine months, one quarter credits revenue to the wrong spend and understates efficiency badly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it hides: contract length (a 0.8 looks identical whether you bill monthly or prepay three years), gross margin (it compares ARR to spend, not gross profit to spend), and lifetime entirely. Enterprise at 0.6 with an 8-month payback can be better business than SMB at 0.9 with a 22-month payback.&lt;/p&gt;

&lt;p&gt;Use the magic number as the budget dial and CAC payback as the viability floor. When they disagree, the payback is usually right and the magic number is measuring the wrong thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The common thread
&lt;/h2&gt;

&lt;p&gt;All three fail the same way: the arithmetic is trivial and the definition is not. NRR needs a cohort rule, the Rule of 40 needs a margin rule, the magic number needs a lag rule. Decide those three once, write them down, and the numbers stop moving between meetings.&lt;/p&gt;




&lt;p&gt;Longer write-ups with worked examples and segment benchmarks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://optimetricshub.com/guides/net-revenue-retention" rel="noopener noreferrer"&gt;Net revenue retention&lt;/a&gt; — NRR vs GRR, cohort rules, the three inflators&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://optimetricshub.com/guides/rule-of-40" rel="noopener noreferrer"&gt;The Rule of 40&lt;/a&gt; — which margin, score bands, where it misleads&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://optimetricshub.com/guides/saas-magic-number" rel="noopener noreferrer"&gt;SaaS magic number&lt;/a&gt; — the lag problem, what it hides&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also built free no-signup calculators for &lt;a href="https://optimetricshub.com/tools/churn-calculator" rel="noopener noreferrer"&gt;churn&lt;/a&gt;, &lt;a href="https://optimetricshub.com/tools/runway-calculator" rel="noopener noreferrer"&gt;runway&lt;/a&gt; and &lt;a href="https://optimetricshub.com/tools/cac-payback-calculator" rel="noopener noreferrer"&gt;CAC payback&lt;/a&gt;, each showing its formula and derivation.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>saas</category>
      <category>startup</category>
    </item>
    <item>
      <title>Shipping an embeddable calculator: six things I got wrong first</title>
      <dc:creator>牛云鹏</dc:creator>
      <pubDate>Tue, 20 Oct 2026 04:18:23 +0000</pubDate>
      <link>https://dev.to/optimetricshub/shipping-an-embeddable-calculator-six-things-i-got-wrong-first-475h</link>
      <guid>https://dev.to/optimetricshub/shipping-an-embeddable-calculator-six-things-i-got-wrong-first-475h</guid>
      <description>&lt;p&gt;I wanted a calculator that a stranger could drop into their blog with one paste. What I ended up learning was mostly about what &lt;em&gt;not&lt;/em&gt; to put inside an iframe.&lt;/p&gt;

&lt;p&gt;The constraints, in the order they bit me.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The widget cannot carry your site chrome
&lt;/h2&gt;

&lt;p&gt;The first version embedded the whole page: header nav, footer, cookie banner, ad slots. On my site that reads as a finished product. Inside someone else's article it reads as a website crammed into a letterbox, and the first thing the host does is delete it.&lt;/p&gt;

&lt;p&gt;So the embed route has to render &lt;strong&gt;only the tool&lt;/strong&gt;. In Vue that meant one flag on the route and one &lt;code&gt;v-if&lt;/code&gt; in the app shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight vue"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- App.vue --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;header&lt;/span&gt; &lt;span class="na"&gt;v-if=&lt;/span&gt;&lt;span class="s"&gt;"!bare"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;…&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;PrivacyBanner&lt;/span&gt; &lt;span class="na"&gt;v-if=&lt;/span&gt;&lt;span class="s"&gt;"!bare"&lt;/span&gt; &lt;span class="na"&gt;variant=&lt;/span&gt;&lt;span class="s"&gt;"bar"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"bare ? 'px-3 py-3' : 'mx-auto max-w-5xl px-4 py-8'"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;RouterView&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;footer&lt;/span&gt; &lt;span class="na"&gt;v-if=&lt;/span&gt;&lt;span class="s"&gt;"!bare"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;…&lt;span class="nt"&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bare&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computed&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bare&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines of state, a handful of &lt;code&gt;v-if&lt;/code&gt;s. The alternative — a second app entry point — is the kind of duplication that quietly drifts until the embedded version shows last quarter's formula.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. No ads, and say so
&lt;/h2&gt;

&lt;p&gt;An ad inside your iframe renders on someone else's page. That is their inventory, their layout and their audience. It is also the fastest way to get the embed pulled and the domain remembered badly.&lt;/p&gt;

&lt;p&gt;The same applies to analytics in any form that a host would notice. Mine loads a site-wide tag in &lt;code&gt;index.html&lt;/code&gt;, which the embed inherits — that one I accepted because it is aggregate pageview counting and nothing about the widget's inputs leaves the browser. Anything more invasive would have to be stripped per-route.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;noindex&lt;/code&gt; the embed, canonical it to the real page
&lt;/h2&gt;

&lt;p&gt;Here is the trap: the embed page is a near-duplicate of the tool page. Left indexable, it competes with the page you actually want to rank.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"robots"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"noindex, follow"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"canonical"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://example.com/tools/ltv-cac-calculator"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;follow&lt;/code&gt; rather than &lt;code&gt;noindex, nofollow&lt;/code&gt;: crawlers should still walk the attribution link back to the real page. And the canonical points at the tool page, not at itself — the embed is a rendering of that page, not a page of its own.&lt;/p&gt;

&lt;p&gt;Also: leave the embeds &lt;strong&gt;out of the sitemap&lt;/strong&gt;. If your sitemap is generated from a route table, exclude them explicitly, otherwise you are telling Google "please index these noindex pages" — which it will report as an error for weeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Size is a suggestion the host will ignore
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;iframe width="100%" height="640"&amp;gt;&lt;/code&gt; is what I ship, and roughly half of hosts will paste it into a column that is 500px wide. That is fine — the widget is responsive — but it means &lt;strong&gt;height cannot be computed from width&lt;/strong&gt;. A two-column form-plus-result layout that fits at 900px stacks at 500px and gets taller.&lt;/p&gt;

&lt;p&gt;Fix: measure it, do not guess. A 20-line script in the embed page posts its height to the parent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ro&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResizeObserver&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ltv-cac&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scrollHeight&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="nx"&gt;ro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;observe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the host's one-liner listens. Ship the fixed-height iframe as the default so a host who pastes and walks away still gets something usable, and treat auto-resize as the upgrade.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`iframe[data-embed="&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"]`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. &lt;code&gt;loading="lazy"&lt;/code&gt; is not optional
&lt;/h2&gt;

&lt;p&gt;An embed at the top of a long article otherwise blocks that article's first paint for a host who never asked for it. It is one attribute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"…"&lt;/span&gt; &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"border:1px solid #e2e8f0;border-radius:12px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. The attribution link is the entire point
&lt;/h2&gt;

&lt;p&gt;Be honest about the incentive: the reason to build an embed is the link. So put it somewhere a human actually reads, make it small and legible, and do not hide it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://example.com/tools/ltv-cac-calculator"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"noopener"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  LTV:CAC Ratio Calculator
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt; by Example — free, no signup, nothing stored.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things I would not do: &lt;code&gt;target="_top"&lt;/code&gt; on that link (it hijacks the host's navigation) and a "powered by" that only appears after 30 days (nobody trusts it, and it gets patched out).&lt;/p&gt;

&lt;h2&gt;
  
  
  What the whole thing cost
&lt;/h2&gt;

&lt;p&gt;One route per tool, one bare-rendering page, one component that prints the snippet with a copy button. No build step, no script tag, no third-party runtime — which also means nothing to sandbox, no CSP negotiation with the host, and no way for the embed to break their page.&lt;/p&gt;

&lt;p&gt;An iframe is the boring answer. For a widget that must never interfere with someone else's site, boring is the feature.&lt;/p&gt;




&lt;p&gt;The live version, if you want to see the bare rendering: &lt;a href="https://optimetricshub.com/embed/ltv-cac" rel="noopener noreferrer"&gt;embed page&lt;/a&gt;, and the &lt;a href="https://optimetricshub.com/tools/ltv-cac-calculator" rel="noopener noreferrer"&gt;copy-paste block&lt;/a&gt; it belongs to.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>vue</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Six SaaS metric formulas and the edge cases that break them</title>
      <dc:creator>牛云鹏</dc:creator>
      <pubDate>Tue, 20 Oct 2026 04:12:40 +0000</pubDate>
      <link>https://dev.to/optimetricshub/six-saas-metric-formulas-and-the-edge-cases-that-break-them-377l</link>
      <guid>https://dev.to/optimetricshub/six-saas-metric-formulas-and-the-edge-cases-that-break-them-377l</guid>
      <description>&lt;p&gt;Every SaaS metric calculator is five lines of arithmetic. The bugs are all in the edges.&lt;/p&gt;

&lt;p&gt;I wrote six of them — LTV:CAC, CAC payback, quick ratio, MRR/ARR, churn rate and runway — and wrote the tests before the UI. Below are the cases that return an answer which looks completely reasonable and is completely wrong. They are worth knowing even if you never build a calculator, because the same arithmetic sits inside every spreadsheet that reports these numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Zero churn makes LTV infinite
&lt;/h2&gt;

&lt;p&gt;Average customer lifetime is &lt;code&gt;100 / monthlyChurnPct&lt;/code&gt;. At zero churn that is &lt;code&gt;Infinity&lt;/code&gt;, so LTV is &lt;code&gt;Infinity&lt;/code&gt;, so the LTV:CAC ratio is &lt;code&gt;Infinity&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Nothing throws. The UI renders a number. The number is unbeatable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lifetimeMonths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;churnPct&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;churnPct&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ltv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;lifetimeMonths&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;arpu&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;grossMargin&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;lifetimeMonths&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return &lt;code&gt;null&lt;/code&gt; and render "unbounded" with a note that real cohorts always churn eventually. An explicit &lt;code&gt;null&lt;/code&gt; beats a helpful default, because a default can be silently summed into a total while &lt;code&gt;null&lt;/code&gt; has to be handled.&lt;/p&gt;

&lt;p&gt;Same trap on the other side: &lt;code&gt;CAC = 0&lt;/code&gt; makes the ratio infinite. Zero CAC is never true, it means the denominator was not filled in.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Annual contracts booked as one month
&lt;/h2&gt;

&lt;p&gt;A $1,200 annual plan is $100 of MRR. Booking the cash when it lands gives you this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;March MRR jumps by $1,200&lt;/li&gt;
&lt;li&gt;April MRR falls by $1,100 relative to March&lt;/li&gt;
&lt;li&gt;Every chart downstream — net new MRR, growth rate, quick ratio — inherits the spike and the crash&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The twelve-fold error is not a rounding problem, it is a definition problem: &lt;strong&gt;MRR is a rate, not a receipt.&lt;/strong&gt; Amortise the contract across its term before it reaches any metric.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mrr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;billingPeriod&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;annual&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;planPrice&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;planPrice&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. LTV on revenue instead of gross profit
&lt;/h2&gt;

&lt;p&gt;The 3x rule of thumb assumes gross profit. Using revenue inflates LTV by &lt;code&gt;1 / grossMargin&lt;/code&gt; — at an 80% margin that is 25% too high, at 50% it is double.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// wrong: compares revenue to a cost&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ltv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arpu&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;lifetimeMonths&lt;/span&gt;

&lt;span class="c1"&gt;// right: compares profit to a cost&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ltv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arpu&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;grossMargin&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;lifetimeMonths&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This one is nasty because the result still looks like a number. At a 70% margin a business at 2.1x looks like 3.0x, and the conclusion flips from "underinvesting" to "healthy".&lt;/p&gt;

&lt;h2&gt;
  
  
  4. CAC payback without the margin
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paybackMonths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cac&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arpu&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;grossMargin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop &lt;code&gt;grossMargin&lt;/code&gt; and payback shrinks by the margin: at 80% a real 6.25-month payback reports as 5.0. The rule of thumb is "under 12 months", so a 15-month payback reported as 12 sits exactly on the boundary and passes.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Quick ratio when nothing churned
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;quickRatio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mrrLost&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mrrGained&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;mrrLost&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A month with no churn is either a tiny base or a data problem. Rendering &lt;code&gt;Infinity&lt;/code&gt; makes it indistinguishable from a genuinely excellent month, and it will be copied into a board deck.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Money is not a float
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;0.1 + 0.2&lt;/code&gt; is &lt;code&gt;0.30000000000000004&lt;/code&gt;. It does not matter at these magnitudes until you start summing and comparing — and then &lt;code&gt;paybackMonths &amp;lt;= 12&lt;/code&gt; is false for what a human computes as 12.0.&lt;/p&gt;

&lt;p&gt;For a single calculation, round only at the point of display. If you are summing rows, store integer cents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;round&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;dp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;dp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The general rule
&lt;/h2&gt;

&lt;p&gt;Every one of these is the same bug wearing a different hat: &lt;strong&gt;a missing value is not zero, and an unbounded value is not a large one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A calculator whose inputs are optional and whose outputs are numbers needs a third state. &lt;code&gt;null&lt;/code&gt; in the model, an explicit "not enough information" in the UI. The alternative is a dashboard that is confidently wrong, which is worse than one that is visibly empty.&lt;/p&gt;




&lt;p&gt;I put these six into free, no-signup calculators — &lt;a href="https://optimetricshub.com/tools/ltv-cac-calculator" rel="noopener noreferrer"&gt;LTV:CAC&lt;/a&gt;, &lt;a href="https://optimetricshub.com/tools/cac-payback-calculator" rel="noopener noreferrer"&gt;CAC payback&lt;/a&gt;, &lt;a href="https://optimetricshub.com/tools/quick-ratio-calculator" rel="noopener noreferrer"&gt;quick ratio&lt;/a&gt;, &lt;a href="https://optimetricshub.com/tools/mrr-calculator" rel="noopener noreferrer"&gt;MRR &amp;amp; ARR&lt;/a&gt;, &lt;a href="https://optimetricshub.com/tools/churn-calculator" rel="noopener noreferrer"&gt;churn&lt;/a&gt; and &lt;a href="https://optimetricshub.com/tools/runway-calculator" rel="noopener noreferrer"&gt;runway&lt;/a&gt;. Every one shows its formula and its derivation, and the edge cases above are covered by tests rather than by hope.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>saas</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
