You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8cdc1e6
Browse filesBrowse the repository at this point in the historyBrowse files
feat(wizard): send analytics straight to PostHog (#71)
The funnel events landed in #68 posting to a Seam endpoint that would
forward them to PostHog, on the reasoning that a published CLI cannot
hold a PostHog key. The proxy bought nothing — a PostHog project key is
write-only — and it did not exist yet, so every batch a wizard run sent
was a 404 it silently dropped.
Report through the PostHog Node SDK instead, to the same project and the
same host the Console reports to (`https://e.seam.co`, Seam's PostHog
proxy). The SDK owns batching, gzip, retries and the `/batch/` wire
format; `flushAnalytics` becomes its `shutdown()`, still the only
analytics a developer waits for, still bounded.
The key stays out of this repository. `analytics-key.ts` ships an empty
placeholder that `prepack.ts` fills in from SEAM_WIZARD_POSTHOG_KEY when
the package is packed — the mechanism `version.ts` already uses for the
version — and the publish workflow passes it from a repository secret.
A build without one reports nothing at all rather than reporting
somewhere unintended, which also keeps a clone and a pull request build
silent. **The secret has to exist before the next publish**, or the
published wizard reports nothing.
The public surface of analytics.ts is unchanged, so app.tsx keeps its
call sites: what changed is the transport underneath. Two things the
Seam side used to do move here, since nothing sits between the CLI and
PostHog now:
- `distinct_id` is namespaced `wizard_cli_<uuid>` — a Console person's
distinct_id is a UUID too, and a run is an install, not a person;
- the workspace group comes from the SDK's own `groups` argument
rather than a hand-set `$groups` property.
`postWizardEvents` and its wire types are deleted with the proxy.
The SDK sets `$geoip_disable`, so the events still carry no location.
Tests assert against the real gzipped `/batch/` payload rather than a
shape of our own, which is what a local ingest server was used to verify.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments