admin-install-funnel
What it does
Install-funnel analytics for the platform operator: download/install/ first-use/claimed counts, per-day install trends over 30 days, recent install records with contact and account joins, a version breakdown, and a full export of install-instance records. All data comes from items rows under the funnel_signal type where data->>source = 'inst', plus spine_instance rows for the version split.
Framework-internal telemetry about Spine installations (serials, app versions, environments), not customer app data.
Route and methods
None — this file exports no handler. It exports two createHandler-wrapped consts, metrics and exportData, which nothing imports or dispatches. As shipped there is no HTTP entrypoint; treat it as a dormant module pending a dispatch handler (or a wiring bug), not a live endpoint.
Authentication
If wired: requireSystemContextWithAudit runs first — anonymous → 401, non-system_admin → 403. All queries run on adminDb across all accounts (see Agent notes).
Request contract
Neither export reads parameters — metrics uses fixed windows and exportData returns the full matching set.
Response contract
metrics →
{
"total_downloads": 0,
"unique_installers": 0,
"active_instances": 0,
"conversion_funnel": { "downloads": 0, "installations": 0, "first_use": 0, "claimed": 0 },
"install_trends": [{ "date": "YYYY-MM-DD", "downloads": 0, "installations": 0 }],
"recent_installs": [{ "id": "…", "serial": "…", "app_version": "…", "environment": "…",
"first_seen_at": "…", "last_signal_at": "…",
"claimed_by": "…", "claimed_at": "…",
"account_name": "…", "person_email": "…" }],
"top_versions": [{ "version": "…", "count": 0, "percentage": 0 }]
}Field semantics:
total_downloads/installations/first_use—funnel_signalrows withaction_typedownload/install/first_command.unique_installers— distinctdata->>serialvalues.active_instances— serialized signals seen in the last 7 days.claimed— signals with non-nulldata->>claimed_by_person_id.install_trends— 30 daily buckets of download + install counts.recent_installs— latest 20 serialized signals joined topeople(email)andaccounts(name).top_versions— up to 10 versions byspine_instancecount share.
exportData → { instances, exported_at, total_count } — every funnel_signal row with source='inst' and a serial, full data bag, account_id, and the same people/accounts joins, newest first.
Side effects
None — read-only.
Errors
No explicit error paths. When the funnel_signal type is absent (app-seeded; missing on a clean install) metrics returns a zeroed payload and exportData returns { instances: [], …, total_count: 0 }. The 30-day trend loop issues two count queries per day (60 sequential queries) — slow but not an error.
Agent notes
- Verify before use — no
handlerexport means no routed endpoint;?action=export-style dispatch does not exist in the file. - Platform-wide PII, system-gated.
exportDataand therecent_installsjoin returnpeople.emailandaccounts.nameacross all accounts viaadminDb. Both exports already runrequireSystemContextWithAudit, so onlysystem_adminreaches them if wired. before exposing these exports. - The daily-trend loop is 60 round trips per call — do not put it on a hot path; if the endpoint is wired for real use, fold the loop into a single grouped query or RPC.
serialis the installer-instance identity;claimed_by_person_idlinks an install to a registered person — that join is what makes the export PII-bearing.