Skip to Content
Living documentation — last reviewed 2026-05-28
FeaturesAnalyticsAnalytics

Analytics

The dashboard’s analytics tab — revenue, members, classes, and workouts metrics for an org’s owner and admins. Implemented as a wide, deliberately denormalized read surface over the operational tables.

What

GET /organizations/:orgId/analytics/... returns per-area summaries and trend series:

SurfaceEndpointService method
Revenue summaryGET /analytics/revenue/summarygetRevenueSummary
Revenue trendGET /analytics/revenue/trend?months=12getRevenueTrend
Plan distributionGET /analytics/revenue/plan-distributiongetPlanDistribution
Members summaryGET /analytics/members/summarygetMembersSummary
Members growthGET /analytics/members/growth?months=6getMembersGrowth
Members activationGET /analytics/members/activationgetMembersActivation
At-risk membersGET /analytics/members/at-risk?sample=5getAtRiskMembers
Popular classesGET /analytics/classes/popular?days=30&limit=10getPopularClasses
Class utilizationGET /analytics/classes/utilization?days=30getClassUtilization
Workouts summaryGET /analytics/workouts/summarygetWorkoutsSummary
Coach overviewGET /analytics/coaches/overviewgetCoachOverview
CSV exportGET /analytics/export?tab=<tab>per-tab payload → toCsv

Why

  • Owners track the gym as a business. Without revenue, MRR, debt, churn, and class utilization in one place, they fall back on spreadsheets.
  • The same metrics power the Spotter agent’s analytics.* tool family — agent answers like “how’s the gym doing?” pull from this service.
  • Keeping every query close to the operational tables means metrics never lag — there is no nightly aggregation job that could drift.

Who

  • Owner / admin — full access (role-gated server-side).
  • Coach / member — no access (403).
  • Spotter agent — staff-only via the agent tools.

Persona impact

PersonaImpact
OwnerSingle-pane view on revenue, growth, retention, programming engagement. CSV export for each tab to share with accountant/business advisor.
AdminSame as owner.
CoachCoach Overview (separate endpoint) gives them their own students-and-engagement view; the broader analytics tab is locked.

Capabilities

Revenue

  • MRR computation normalized by plan interval (INTERVAL_MONTHS mapping in analytics.service.ts).
  • Month-over-month delta percentages on MRR and collected revenue.
  • Outstanding receivables (subscriptions with debt > 0).
  • 12-month trend by month-start bucket; configurable horizon.
  • Plan distribution: active subs per plan with monthly revenue contribution.

Members

  • Total / active / activated-active counts (the activatedActive discriminator distinguishes Clerk-linked from CSV-imported members).
  • New + churned this month with MoM deltas.
  • Activation funnel (importedinvitedactivated).
  • At-risk sample (past-due subscriptions) with ?sample=N cap.
  • Growth trend over configurable months.

Classes

  • Most-booked class types over a window.
  • Capacity fill rate per class type plus a roll-up.

Workouts

  • Assignments scheduled / completed MTD, PRs MTD.

Coach overview

  • Per-coach panel: assigned athletes, recent activity, programming load.

CSV exports

  • Per-tab synchronous CSV via GET /analytics/export?tab=... — handler builds the same rows the dashboard renders, then writes them as CSV with Content-Disposition: attachment.
  • insights — small ranked widget; the agent’s org_insights tool delegates to it.
  • payments / subscriptions — source of all revenue metrics.
  • memberships / users — source of growth + activation metrics.
  • class-sessions / bookings / class-types — source of class metrics.
  • workouts / workout-assignments / workout-results — source of workout metrics.
  • spotter-agentanalytics.* tools mirror these endpoints 1:1 for the agent.

Status

Shipped. New endpoints land as the dashboard grows. CSV export covers the most-requested tabs.

Gaps

  • All metrics are computed on-read with no caching layer. A 5000-member org with 5 years of payment history will see latency creep. Pre-aggregated rollups remain future work.
  • No cohort retention, LTV, or churn curve — only point-in-time counts and MoM deltas.
  • Class utilization is over a fixed past window — no “next 30 days at current bookings pace” forecast.
  • CSV exports are synchronous; very large orgs may need the async queue path the members export uses.
  • No PostHog/Mixpanel-style event funnel — pure SQL aggregations on operational tables.