Skip to content

Conversation

@MODSetter
Copy link
Owner

@MODSetter MODSetter commented Jan 2, 2026

Description

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR enhances user analytics by integrating PostHog tracking for login and logout events. It introduces a new PostHogIdentify component that automatically identifies users when logged in and resets identity on logout. The implementation tracks both local and OAuth (Google) login successes using sessionStorage to prevent duplicate tracking, and adds logout tracking with identity reset in multiple logout locations. Minor formatting cleanup is also included.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/lib/posthog/events.ts
2 surfsense_web/components/providers/PostHogIdentify.tsx
3 surfsense_web/components/providers/PostHogProvider.tsx
4 surfsense_web/app/(home)/login/LocalLoginForm.tsx
5 surfsense_web/components/TokenHandler.tsx
6 surfsense_web/components/UserDropdown.tsx
7 surfsense_web/components/sidebar/app-sidebar.tsx
8 surfsense_web/app/(home)/login/GoogleLoginButton.tsx
9 surfsense_web/components/homepage/footer-new.tsx
⚠️ Inconsistent Changes Detected
File Path Warning
surfsense_web/components/homepage/footer-new.tsx This file contains only whitespace/formatting changes (indentation fix and removal of blank line) which is unrelated to the login tracking and logout functionality theme of this PR

Need help? Join our Discord

Analyze latest changes

- Added session storage flag to track local login success, ensuring OAuth flows do not double track login events.
- Implemented tracking for logout events in both UserDropdown and AppSidebar components, resetting PostHog identity accordingly.
- Minor formatting adjustments in GoogleLoginButton and footer-new components for consistency.
@vercel
Copy link

vercel bot commented Jan 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
surf-sense-frontend Building Building Preview, Comment Jan 2, 2026 9:11am

@MODSetter MODSetter merged commit 7360938 into main Jan 2, 2026
4 of 6 checks passed
Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on ae1c3f9..70890bd

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (8)

surfsense_web/app/(home)/login/GoogleLoginButton.tsx
surfsense_web/app/(home)/login/LocalLoginForm.tsx
surfsense_web/components/TokenHandler.tsx
surfsense_web/components/UserDropdown.tsx
surfsense_web/components/homepage/footer-new.tsx
surfsense_web/components/providers/PostHogIdentify.tsx
surfsense_web/components/providers/PostHogProvider.tsx
surfsense_web/components/sidebar/app-sidebar.tsx

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.

2 participants