Make PostHog analytics fully anonymous
Set person_profiles: "never" so PostHog never creates user profiles. Remove identifyUser calls from login and fetchUser flows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ export function initAnalytics() {
|
||||
"https://analytics.88oakapps.com",
|
||||
capture_pageview: true,
|
||||
capture_pageleave: true,
|
||||
person_profiles: "never",
|
||||
});
|
||||
initialized = true;
|
||||
}
|
||||
@@ -34,12 +35,6 @@ export function trackScreen(screenName: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export function identifyUser(userId: string, traits?: Record<string, unknown>) {
|
||||
if (initialized) {
|
||||
posthog.identify(userId, traits);
|
||||
}
|
||||
}
|
||||
|
||||
export function resetAnalytics() {
|
||||
if (initialized) {
|
||||
posthog.reset();
|
||||
|
||||
+1
-9
@@ -1,7 +1,7 @@
|
||||
import { create } from 'zustand';
|
||||
import * as authApi from '@/lib/api/auth';
|
||||
import { getQueryClient } from '@/lib/query/query-client';
|
||||
import { trackEvent, identifyUser, resetAnalytics, AnalyticsEvents } from '@/lib/analytics';
|
||||
import { trackEvent, resetAnalytics, AnalyticsEvents } from '@/lib/analytics';
|
||||
import type { UserResponse } from '@/lib/api/auth';
|
||||
|
||||
interface AuthState {
|
||||
@@ -33,10 +33,6 @@ export const useAuthStore = create<AuthState>()((set) => ({
|
||||
set({ isLoading: true, error: null });
|
||||
try {
|
||||
const response = await authApi.login(credentials);
|
||||
identifyUser(String(response.user.id), {
|
||||
email: response.user.email,
|
||||
name: `${response.user.first_name} ${response.user.last_name}`.trim(),
|
||||
});
|
||||
trackEvent(AnalyticsEvents.USER_SIGNED_IN, { method: 'email', platform: 'web' });
|
||||
set({ user: response.user, isAuthenticated: true, isLoading: false });
|
||||
window.location.href = '/app';
|
||||
@@ -87,10 +83,6 @@ export const useAuthStore = create<AuthState>()((set) => ({
|
||||
set({ isLoading: true, error: null });
|
||||
try {
|
||||
const user = await authApi.getCurrentUser();
|
||||
identifyUser(String(user.id), {
|
||||
email: user.email,
|
||||
name: `${user.first_name} ${user.last_name}`.trim(),
|
||||
});
|
||||
set({ user, isAuthenticated: true, isLoading: false });
|
||||
} catch {
|
||||
set({ user: null, isAuthenticated: false, isLoading: false });
|
||||
|
||||
Reference in New Issue
Block a user