Analytics
Owner/admin analytics has the existing summary/agent analytics and TKN-24 basic reports. Basic reports organize seven projections into three task-focused areas with a Studio KPI snapshot. They do not replace legacy summaries or their eight CSV exports. Report projections are read-only.
What
Existing summary analytics (unchanged)
All routes below are beneath /organizations/:orgId.
| Surface | Endpoint | Service method |
|---|---|---|
| Revenue summary | GET /analytics/revenue/summary | getRevenueSummary |
| Revenue trend | GET /analytics/revenue/trend?months=12 | getRevenueTrend |
| Plan distribution | GET /analytics/revenue/plan-distribution | getPlanDistribution |
| Members summary | GET /analytics/members/summary | getMembersSummary |
| Members growth | GET /analytics/members/growth?months=6 | getMembersGrowth |
| Members activation | GET /analytics/members/activation | getMembersActivation |
| At-risk members | GET /analytics/members/at-risk?sample=5 | getAtRiskMembers |
| Popular classes | GET /analytics/classes/popular?days=30&limit=10 | getPopularClasses |
| Class utilization | GET /analytics/classes/utilization?days=30 | getClassUtilization |
| Workouts summary | GET /analytics/workouts/summary | getWorkoutsSummary |
| Coach overview | GET /analytics/coaches/overview | getCoachOverview |
| CSV export | GET /analytics/export?tab=<tab> | per-tab payload → toCsv |
Basic reports (TKN-24)
Basic reports are available to every organization, subject to analytics:view.
| Surface | Endpoint beneath /organizations/:orgId/analytics |
|---|---|
| Five Studio KPIs | GET /dashboard |
| Attendance, ranking, capacity | GET /attendance/report?from&to&classTypeId? |
| Receipts, methods, monthly revenue | GET /revenue/report?from&to&method? |
| Membership lifecycle cohorts | GET /members/cohorts?months=6&asOf? |
| Matching CSV projections | GET /export?tab=<report-tab> with the same filters |
The localized /[lang]/dashboard/analytics workspace has four areas: Attendance (attendance, class ranking, capacity), Revenue (currency totals, methods, monthly revenue), Retention (membership cohorts), and Trials (trial funnel and breakdowns, see Trials). Each area shares one report dataset fetch across its projections; the three original areas keep their CSV exports, Trials has none. The sidebar entry appears for analytics:view holders. OverviewV2 has no Studio snapshot or report link and does not initiate their report requests; its existing panels remain. English, Hebrew (RTL), and Russian are supported; query errors are not displayed as zeros.
The URL is the source of truth: tab=attendance|revenue|retention|trials plus from, to, classTypeId, method, months, and asOf. Direct links, reload, and back/forward hydrate the same state; implicit org-local defaults are pinned into the URL, and invalid relevant filters block dataset requests and exports rather than silently broadening them. See the exact URL and projection map.
Reports use inclusive org-local dates (maximum 366 days; DST-aware) and membership cohort horizons of 1–12 months. Revenue reuses canonical payments/services/receipts.sql.ts for signed settled receipts, with each currency kept separate and no FX total; it is not MRR. Membership cohorts estimate lifecycle continuity, not historical paid retention. See behavior for exact definitions and accounting audit deferrals, and QA for verification and limits. TKN-24 requires no new table or migration.
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 —
requireMembershipplusPermissionsServiceenforcement ofanalytics:view, for legacy summaries and basic report data/exports alike. - Coach / member — no access (403).
- Spotter agent — staff-only via the agent tools.
Persona impact
| Persona | Impact |
|---|---|
| Owner | Task-focused attendance, revenue, and retention alongside existing summaries; seven basic projection CSVs. |
| Admin | Same as owner. |
| Coach | Broader analytics endpoints are locked; the separate coaching dashboard is not access to owner/admin reports. |
Existing summary capabilities
Revenue
- MRR computation normalized by plan interval (
INTERVAL_MONTHSmapping inanalytics.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
activatedActivediscriminator distinguishes Clerk-linked from CSV-imported members). - New + churned this month with MoM deltas.
- Activation funnel (
imported→invited→activated). - At-risk sample (past-due subscriptions) with
?sample=Ncap. - 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 withContent-Disposition: attachment.
Related features
- Insights — ActionCenter owns actionable follow-up, including birthdays; the agent’s
org_insightstool 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-agent— existinganalytics.*tools use legacy summaries; TKN-24 does not add report tools.
Status
TKN-24 reports are implemented with three basic areas and seven projection/export identifiers, available to every organization. Legacy summary analytics and exports are preserved. QA lists the regression commands; local verification is not production or full responsive certification.
Arbox category disposition
This is a scope map, not a parity checklist:
| Category | Disposition |
|---|---|
| Attendance / class ranking / capacity | Covered by Attendance reports over ended sessions and historical bookings. |
| Members / revenue / retention | Existing member summaries, growth, and activation remain; Revenue covers actual receipts; Retention covers lifecycle cohorts, not paid retention. |
| Birthdays | ActionCenter follow-up action, not another report. |
| Staff attendance / staff actions | Deliberate gap; historical member bookings that now belong to staff do not constitute a staff attendance or audit report. |
| External-subscriber attendance | Deliberate gap; current external occupancy is not a reliable historical attendance source. |
| Referral / blocked / duplicate users | Deliberate gaps; no report added for nominal parity. |
Only measured, actionable gaps with reliable sources become report candidates. This consolidation does not expand into an Arbox parity checklist.
Gaps
- All metrics are computed on-read without a reporting cache or pre-aggregated rollups. Local smoke does not establish production latency or scale.
- Cohorts are lifecycle estimates only: no suspension/reactivation or historical paid-subscription ledger, LTV, or paid-retention curve.
- 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.
- Accounting audit deferrals remain explicit in behavior: legacy scalar multi-currency summaries, PaymentAnalytics date windows, plan list-price distribution versus chargeable MRR, admin raw cross-org receipts, and historical paid-retention data. Reusing receipt SQL does not make every money API interchangeable.