What's wrong
`packages/analytics` has a real, tested implementation: `EventEmitter`, `ConsoleSink`/`HttpSink`/`FileSink`, sampling, deduplication, retry, PII scrubbing, a dead-letter queue — 87 passing tests across 14 files.
`packages/ui` has a completely separate, ad-hoc analytics implementation instead of using it:
- `packages/ui/src/lib/analytics.ts` (28 lines) — its own `track()` + listener registry
- `packages/ui/src/lib/analyticsEvents.ts`, `analyticsPrivacy.ts`, `apiErrorTracking.ts`, `searchTracking.ts` — more parallel, hand-rolled tracking helpers
Nothing in `packages/ui` imports `@stellar-explain/analytics` (checked — zero matches). Whatever `packages/analytics` does (sampling, retry, PII scrubbing, sinks) never actually runs in the app; the UI's own mini-implementation has none of that behavior.
Why it matters
This is likely why analytics "isn't working" in practice — the tested, feature-complete package sits unused while a much thinner duplicate handles real traffic with none of its guarantees (no retry on failed sends, no PII scrubbing, no sampling).
Suggested fix
Either:
- Have `packages/ui`'s tracking calls actually construct and use an `EventEmitter` from `@stellar-explain/analytics` with a real sink (`HttpSink` pointed at the analytics endpoint), removing the duplicate `lib/analytics*.ts` files, or
- If the UI-side implementation was intentionally kept separate for a reason, document why and what `packages/analytics` is actually for.
Depends on #853 — the package has no entry point yet, so it can't be imported until that lands.
What's wrong
`packages/analytics` has a real, tested implementation: `EventEmitter`, `ConsoleSink`/`HttpSink`/`FileSink`, sampling, deduplication, retry, PII scrubbing, a dead-letter queue — 87 passing tests across 14 files.
`packages/ui` has a completely separate, ad-hoc analytics implementation instead of using it:
Nothing in `packages/ui` imports `@stellar-explain/analytics` (checked — zero matches). Whatever `packages/analytics` does (sampling, retry, PII scrubbing, sinks) never actually runs in the app; the UI's own mini-implementation has none of that behavior.
Why it matters
This is likely why analytics "isn't working" in practice — the tested, feature-complete package sits unused while a much thinner duplicate handles real traffic with none of its guarantees (no retry on failed sends, no PII scrubbing, no sampling).
Suggested fix
Either:
Depends on #853 — the package has no entry point yet, so it can't be imported until that lands.