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.
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR integrates PostHog analytics into the SurfSense web application to track user behavior and product usage. It adds the
posthog-jspackage, creates a centralized analytics utility with typed tracking functions, and instruments key user actions including authentication (sign up, login), search space operations, document management, connector operations, chat interactions, podcast generation, LLM configuration, and invite management. The implementation includes a PostHogProvider component for initialization and automatic user identification.⏱️ Estimated Review Time: 15-30 minutes
💡 Review Order Suggestion
surfsense_web/.env.examplesurfsense_web/package.jsonsurfsense_web/pnpm-lock.yamlsurfsense_web/lib/analytics.tssurfsense_web/components/providers/PostHogProvider.tsxsurfsense_web/app/layout.tsxsurfsense_web/app/(home)/register/page.tsxsurfsense_web/components/TokenHandler.tsxsurfsense_web/atoms/search-spaces/search-space-mutation.atoms.tssurfsense_web/atoms/documents/document-mutation.atoms.tssurfsense_web/hooks/use-search-source-connectors.tssurfsense_web/atoms/new-llm-config/new-llm-config-mutation.atoms.tssurfsense_web/atoms/invites/invites-mutation.atoms.tssurfsense_web/lib/chat/thread-persistence.tssurfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsxsurfsense_web/components/sidebar/AppSidebarProvider.tsxsurfsense_web/components/sidebar/all-chats-sidebar.tsxsurfsense_web/components/tool-ui/generate-podcast.tsx