chore: add PostHog analytics to desktop app - #129
Merged
Conversation
…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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app_opened,page_viewed,registry_search,server_installed,server_uninstalledapp_version,os,platformtrackSearch()andtrackServerView()in discover UIVITE_POSTHOG_KEY/VITE_POSTHOG_HOSTsecrets in release CISetup required
Add these GitHub repo secrets before the next release:
VITE_POSTHOG_KEY— PostHog project API keyVITE_POSTHOG_HOST—https://us.i.posthog.comAnalytics silently disables when no key is set (dev builds, CI checks).
Test plan
pnpm dev:web, open console — verify no PostHog errors when key is emptyVITE_POSTHOG_KEYin.env, restart dev — verifyapp_openedevent firespage_viewedevents with correctpagepropertyregistry_searchfires after debouncepnpm typecheck && pnpm lintpass