Metrics: a customer whose first invoice is a renewal is an existing one
When the earliest recurring invoice Stripe has for a customer is a renewal (billing_reason subscription_cycle), they were a customer already, their first year free or billed elsewhere. That first payment now counts as reactivation (movement "existing"), not new: it stays out of New, the cohorts and CAC, and the month's movements still add up. The customers export gives the month first seen paying as first_paid. A $0 trial signup before the first payment still makes a customer new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -158,7 +158,7 @@ func Export(w io.Writer, d *db.DB, name string, now time.Time) error {
|
||||
}
|
||||
write([]string{"customer_id", "name", "email", "mrr_now", "first_paid", "crm_account_id", "crm_account", "matched_by"})
|
||||
for _, m := range ms {
|
||||
if err := write([]string{m.Customer.ID, m.Customer.Name, m.Customer.Email, dollars(m.MRR), model.First[m.Customer.ID],
|
||||
if err := write([]string{m.Customer.ID, m.Customer.Name, m.Customer.Email, dollars(m.MRR), firstPaid(model, m.Customer.ID),
|
||||
m.Account.ID, m.Account.Name, m.How}); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -247,3 +247,12 @@ func joinLines(lines []string) string {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// firstPaid is the month a customer first paid: their cohort's, or, for one
|
||||
// who was already a customer, the month first seen paying.
|
||||
func firstPaid(m *Model, customer string) string {
|
||||
if f := m.First[customer]; f != "" {
|
||||
return f
|
||||
}
|
||||
return m.Existing[customer]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user