🔥 chore(picture): remove PostHog analytics for GDPR compliance

- Remove posthog-js dependency from picture web app
- Delete PostHog integration module and setup documentation
- Remove PostHog initialization from root layout
- Clean up environment variables from .env.example
- Update logger comments to remove Sentry references
- Update PROJECT_OVERVIEW.md to reflect Umami as analytics tool
This commit is contained in:
Till-JS 2026-01-28 12:24:22 +01:00
parent 13754f2d55
commit cb130191ab
10 changed files with 2176 additions and 1778 deletions

View file

@ -1,7 +1,7 @@
/**
* Centralized logging utility
* - Development: Logs to console
* - Production: Can be integrated with Sentry, LogRocket, etc.
* - Production: Logs to console (can be extended for custom error tracking)
*/
const isDevelopment = __DEV__;
@ -38,7 +38,7 @@ export const logger = {
*/
error: (...args: any[]) => {
console.error('[ERROR]', ...args);
// TODO: Send to error tracking service (Sentry, etc.)
// In production: can be extended for custom error tracking
},
/**

View file

@ -11,7 +11,3 @@ PUBLIC_APPLE_CLIENT_ID=
# Umami Analytics
PUBLIC_UMAMI_URL=https://your-umami-instance.com
PUBLIC_UMAMI_WEBSITE_ID=your-website-id
# PostHog Analytics
PUBLIC_POSTHOG_KEY=phc_your_posthog_project_api_key
PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

View file

@ -33,7 +33,6 @@
"@picture/design-tokens": "workspace:*",
"@picture/shared": "workspace:*",
"konva": "^10.0.2",
"posthog-js": "^1.273.1",
"svelte-i18n": "^4.0.1"
},
"devDependencies": {

View file

@ -1,85 +0,0 @@
import posthog from 'posthog-js';
import { browser } from '$app/environment';
import { env } from '$env/dynamic/public';
export function initPostHog() {
const posthogKey = env.PUBLIC_POSTHOG_KEY;
const posthogHost = env.PUBLIC_POSTHOG_HOST;
if (browser && posthogKey && posthogHost) {
posthog.init(posthogKey, {
api_host: posthogHost,
person_profiles: 'identified_only', // Only track identified users
capture_pageview: true, // Automatically capture pageviews
capture_pageleave: true, // Track when users leave pages
// Privacy-friendly settings
opt_out_capturing_by_default: false,
persistence: 'localStorage',
autocapture: false, // Disable automatic event capture for better control
// Session recording (optional - can be disabled)
disable_session_recording: true, // Set to false if you want session recordings
// Performance
loaded: (posthog) => {
if (import.meta.env.DEV) {
console.log('PostHog loaded');
}
},
});
}
}
// Helper functions for common tracking events
export const analytics = {
// Track page view (usually automatic, but available for manual tracking)
pageView: (url?: string) => {
if (browser) {
posthog.capture('$pageview', { url: url || window.location.href });
}
},
// Identify a user
identify: (userId: string, properties?: Record<string, any>) => {
if (browser) {
posthog.identify(userId, properties);
}
},
// Track custom events
track: (eventName: string, properties?: Record<string, any>) => {
if (browser) {
posthog.capture(eventName, properties);
}
},
// Reset user identity (e.g., on logout)
reset: () => {
if (browser) {
posthog.reset();
}
},
// Set user properties
setUserProperties: (properties: Record<string, any>) => {
if (browser) {
posthog.setPersonProperties(properties);
}
},
// Feature flags
isFeatureEnabled: (featureKey: string): boolean => {
if (browser) {
return posthog.isFeatureEnabled(featureKey) ?? false;
}
return false;
},
// Get feature flag value
getFeatureFlag: (featureKey: string): string | boolean | undefined => {
if (browser) {
return posthog.getFeatureFlag(featureKey);
}
return undefined;
},
};
export default posthog;

View file

@ -4,7 +4,6 @@
import { authStore } from '$lib/stores/auth.svelte';
import Toast from '$lib/components/ui/Toast.svelte';
import { onMount } from 'svelte';
import { initPostHog, analytics } from '$lib/analytics/posthog';
// Import and initialize theme
import { theme } from '$lib/stores/theme';
@ -18,18 +17,8 @@
// Initialize theme (applies CSS variables and loads from localStorage)
const cleanupTheme = theme.initialize();
// Initialize PostHog
initPostHog();
// Initialize auth with Mana Core
authStore.initialize().then(() => {
// Identify user in PostHog if logged in
if (authStore.user) {
analytics.identify(authStore.user.id, {
email: authStore.user.email,
});
}
});
authStore.initialize();
return () => {
cleanupTheme();