Skip to content

chore: add PostHog analytics to desktop app - #129

Merged
its-mash merged 7 commits into
mainfrom
feat/analytics
Feb 20, 2026
Merged

chore: add PostHog analytics to desktop app#129
its-mash merged 7 commits into
mainfrom
feat/analytics

Conversation

@its-mash

Copy link
Copy Markdown
Member

Summary

  • Add anonymous PostHog analytics to the desktop app (posthog-js) with env-var config
  • Track core product events: app_opened, page_viewed, registry_search, server_installed, server_uninstalled
  • Super properties on every event: app_version, os, platform
  • Opt-out toggle in Settings page (persisted in Zustand store)
  • Wire up unused trackSearch() and trackServerView() in discover UI
  • Pass VITE_POSTHOG_KEY/VITE_POSTHOG_HOST secrets in release CI

Setup required

Add these GitHub repo secrets before the next release:

  • VITE_POSTHOG_KEY — PostHog project API key
  • VITE_POSTHOG_HOSThttps://us.i.posthog.com

Analytics silently disables when no key is set (dev builds, CI checks).

Test plan

  • Run pnpm dev:web, open console — verify no PostHog errors when key is empty
  • Set VITE_POSTHOG_KEY in .env, restart dev — verify app_opened event fires
  • Navigate sidebar — verify page_viewed events with correct page property
  • Search in registry — verify registry_search fires after debounce
  • Toggle analytics off in Settings — verify events stop
  • pnpm typecheck && pnpm lint pass

…acking

Add anonymous usage analytics to understand active users, OS distribution,
app versions, server popularity, and search behavior.

Desktop app:
- PostHog JS SDK with env-var config (VITE_POSTHOG_KEY/VITE_POSTHOG_HOST)
- Core events: app_opened, page_viewed, registry_search,
  server_installed, server_uninstalled
- Super properties: app_version, os, platform
- Opt-out toggle in Settings with Zustand persistence
- Analytics silently disabled when no PostHog key is set

Discover UI:
- Wire up trackSearch() on debounced search input
- Wire up trackServerView() on server detail pages

CI:
- Pass VITE_POSTHOG_KEY/HOST secrets to release build

Signed-off-by: McpMux <hello@mcpmux.com>
Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
PostHog config is handled via CI secrets only.

Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
@its-mash its-mash changed the title feat: add PostHog analytics to desktop app chore: add PostHog analytics to desktop app Feb 20, 2026
The App.test.tsx mock for @/hooks/useDomainEvents was missing the
useDomainEvents export used by the new useAnalytics hook, causing
all 12 App tests to fail in CI.

Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
@its-mash
its-mash merged commit cbebd05 into main Feb 20, 2026
13 checks passed
@its-mash
its-mash deleted the feat/analytics branch February 20, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant