Move inactive projects out of active workspace: - bauntown (community website) - maerchenzauber (AI story generation) - memoro (voice memo app) - news (news aggregation) - nutriphi (nutrition tracking) - reader (reading app) - uload (URL shortener) - wisekeep (AI wisdom extraction) Update CLAUDE.md documentation: - Add presi to active projects - Document archived projects section - Update workspace configuration Archived apps can be re-activated by moving back to apps/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
7.7 KiB
PostHog Analytics Implementation
This document outlines all the analytics events being tracked in the Storyteller app using PostHog.
Event Categories
Authentication Events
Login/Registration
-
auth_attempt- Properties:
method: "email"type: "login" | "register"email_domain: string
- Properties:
-
auth_success- Properties:
method: "email"type: "login" | "register"email_domain: string
- Properties:
-
auth_error- Properties:
method: "email"type: "login" | "register"error: stringemail_domain: string
- Properties:
Password Reset
-
password_reset_requested- Properties:
email_provided: boolean
- Properties:
-
password_reset_success- Properties:
email_domain: string
- Properties:
Logout
user_logout_attemptuser_logout_successuser_logout_error- Properties:
error: string
- Properties:
Session Events
-
session_started- Properties:
device_type: stringscreen_size: { width: number, height: number }user_id: stringis_new_user: boolean
- Properties:
-
session_ended- Properties:
session_duration: number (seconds)user_id: string
- Properties:
Story Reading Events
Core Story Events
-
story_started- Properties:
story_id: stringstory_title: stringcharacter_name: stringtotal_slides: number
- Properties:
-
story_slide_viewed- Properties:
story_id: stringstory_title: stringcharacter_name: stringslide_number: numbertotal_slides: number
- Properties:
-
story_ended- Properties:
story_id: stringstory_title: stringcharacter_name: string
- Properties:
-
story_restarted- Properties:
story_id: stringstory_title: stringcharacter_name: string
- Properties:
Character Creation Events
Page Events
character_creation_page_viewed
Core Character Events
-
character_creation_started- Properties:
has_image: booleanethnicity: stringgender: stringage_range: "adult" | "minor"
- Properties:
-
character_created_successfully- Properties:
character_id: string
- Properties:
Image Upload Flow
-
character_image_upload_started- Triggered when user initiates image upload process
-
character_image_permission_denied- Triggered when user denies photo library access
-
character_image_selected- Triggered when user successfully selects an image
Manual Creation
character_creation_manual_started- Triggered when user chooses to create character without image
Performance Events
-
character_analysis_performance- Properties:
duration_seconds: numbersuccess: boolean
- Properties:
-
character_analysis_success- Properties:
detected_characteristics: string[]
- Properties:
-
character_analysis_error- Properties:
error: stringimage_size: number
- Properties:
Story Creation Events
Page Events
story_creation_page_viewed
Core Story Events
-
story_creation_started- Properties:
character_id: stringcharacter_name: stringstory_length: number
- Properties:
-
story_created_successfully- Properties:
character_id: stringcharacter_name: stringstory_length: number
- Properties:
Character Selection
character_selected_for_story- Properties:
character_id: stringcharacter_name: string
- Properties:
Error Events
story_creation_error- Properties:
error: string- Possible values:
"empty_story""no_character_selected""unknown_error"- Or specific error message from API/backend
- Possible values:
character_id: string (if available)
- Properties:
Using This Data
Key Metrics to Track
-
User Engagement and Retention
- Session duration and frequency
- Feature usage patterns
- Onboarding completion rate
- User return rate (via
onboarding_reopened) - Track feature adoption through
feature_toggle
-
Authentication and User Flow
- Login/registration success rates
- Password reset frequency
- Session durations
- Onboarding completion funnel
-
Character Creation Success Rate
- Compare
character_creation_startedvscharacter_created_successfully - Monitor distribution of manual vs. image-based creation
- Track image analysis performance
- Compare
-
Story Creation Success Rate
- Compare
story_creation_startedvsstory_created_successfully - Monitor average story length
- Track story generation performance
- Compare
-
User Engagement
- Track character reuse through
character_selected_for_story - Monitor character creation methods (image vs. manual)
- Analyze session frequency and duration
- Track character reuse through
-
Error Analysis
- Monitor frequency and types of errors through
story_creation_error - Track permission issues through
character_image_permission_denied - Analyze authentication failures
- Monitor API performance issues
- Monitor frequency and types of errors through
PostHog Dashboard Suggestions
-
User Journey Dashboard
- Authentication success rates by type (login/register)
- Session duration trends over time
- Onboarding completion funnel
- Feature adoption rates
- User retention curves
-
Authentication & Security Dashboard
- Login success/failure rates
- Password reset frequency
- Error distribution by type
- Session duration patterns
- Device/platform distribution
-
Story Reading Dashboard
- Story completion rates
- Average time spent per slide
- Most engaging story sections
- Story restart frequency
- Overall story engagement metrics
-
Character Creation Dashboard
- Success rate funnel
- Image vs. manual creation distribution
- Character demographics distribution
- Image analysis performance metrics
- Error rate by step
-
Story Creation Dashboard
- Success rate funnel
- Story generation performance trends
- Average story length trends
- Most used characters
- Error rate and distribution
-
Performance Monitoring Dashboard
- API response times
- Story generation duration
- Image analysis duration
- Error rates by endpoint
- Client-side performance metrics
-
User Engagement Dashboard
- Active users (daily/weekly/monthly)
- Session frequency and duration
- Feature usage heatmap
- Characters per user
- Stories per character
- Onboarding completion rates
Onboarding Events
-
onboarding_started -
onboarding_step_completed- Properties:
step_number: numbertime_spent: number (seconds)slide_title: string
- Properties:
-
onboarding_skipped- Properties:
skipped_at_slide: numbertotal_slides: number
- Properties:
-
onboarding_completed- Properties:
total_slides_viewed: numbertotal_time: number (seconds)
- Properties:
-
onboarding_ended- Properties:
total_time: number (seconds)completed_slides: numbercompleted: boolean
- Properties:
-
onboarding_reopened- Properties:
user_age_days: number
- Properties:
Performance Events
story_generation_performance- Properties:
duration_seconds: numberstory_length: numbersuccess: boolean
- Properties:
Feature Usage Events
feature_toggle- Properties:
feature: string (e.g., "debug_borders")enabled: boolean
- Stories per character
- Session duration
- Return rate
- Properties:
Implementation Details
The analytics are implemented using the usePostHog custom hook located in src/hooks/usePostHog.ts. This hook automatically:
- Initializes PostHog tracking
- Identifies users when they log in
- Provides a consistent interface for event tracking across the app
Usage Example
import { usePostHog } from '../src/hooks/usePostHog';
function YourComponent() {
const posthog = usePostHog();
const handleAction = () => {
posthog?.capture('event_name', {
property1: 'value1',
property2: 'value2',
});
};
}