Skip to content

feat(analytics): add PostHog analytics opt-out - #376

Merged
tompscanlan merged 5 commits into
mainfrom
feature/analytics-optout
Feb 8, 2026
Merged

tompscanlan merged 5 commits into
mainfrom
feature/analytics-optout

Conversation

@tompscanlan

@tompscanlan tompscanlan commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Configure PostHog with cross-subdomain cookie (cookie_domain, cross_subdomain_cookie, opt_out_capturing_persistence_type: 'cookie')
  • Add optOut(), optIn(), hasOptedOut(), syncWithPreference() to analyticsService
  • Create AnalyticsBanner.vue — non-intrusive banner with "Got it" and "Opt out" buttons
  • Add Privacy & Analytics toggle to DashboardProfileForm.vue — persists to API on change
  • Sync analytics preference from API on login via auth-store
  • Add AnalyticsPreferences type to UserPreferences

Part of cross-repo analytics opt-out feature (om-tfpk):

Config changes needed

  • Platform prod config.json: add "APP_POSTHOG_COOKIE_DOMAIN": ".openmeet.net"
  • Platform dev config.json: add "APP_POSTHOG_COOKIE_DOMAIN": ".dev.openmeet.net"

Test plan

  • Unit tests for analyticsService (7 tests)
  • Unit tests for AnalyticsBanner visibility/actions (6 tests)
  • Unit tests for DashboardProfileForm privacy toggle (6 tests)
  • Manual: Visit platform anonymously → banner appears → "Opt out" sets PostHog cookie
  • Manual: Log in → profile settings → toggle reflects opt-out state
  • Manual: Toggle opt-in → verify API updated, PostHog capturing resumes
  • Manual: Log in on new browser → verify API preference syncs to cookie

- Add optOut/optIn/hasOptedOut/syncWithPreference to analyticsService
- Configure PostHog with cross-subdomain cookie and opt-out persistence
- Add AnalyticsBanner component with dismiss and opt-out buttons
- Add Privacy & Analytics toggle to DashboardProfileForm
- Sync analytics preference from API on login via auth-store
- Add AnalyticsPreferences type to UserPreferences

Closes: om-tfpk
- Use type assertion for cookie_domain (valid PostHog option but missing
  from TS types in this version)
- Add preferences to authApi.updateMe parameter type
Use a ref for dismissed state instead of relying on non-reactive
localStorage reads inside a computed property.
Add PostHog analytics section (section 5), update data sharing to name
service providers, add analytics opt-out to user control section, and
renumber all subsequent sections to match biz site privacy policy.
Replace localStorage with a cookie on the shared domain so dismissing
the analytics banner on one site (biz/platform) hides it on the other.
@tompscanlan
tompscanlan merged commit 1ea7e58 into main Feb 8, 2026
3 checks passed
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