To enable analytics in your project, follow these steps:
- Go to Google Analytics
- Create a new account
- Create a new Property for your website
- Copy the Measurement ID (format:
G-XXXXXXXXXX)
Create .env.local file in the frontend/ directory:
# Google Analytics 4 Measurement ID
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXXYou can copy from .env.example:
cp frontend/.env.example frontend/.env.local- Go to your repository Settings
- Navigate to Secrets and variables → Actions
- Add new repository secret:
- Name:
NEXT_PUBLIC_GA_MEASUREMENT_ID - Value: Your actual GA4 Measurement ID
- Name:
- Go to Pages settings
- Add environment variable:
- Name:
NEXT_PUBLIC_GA_MEASUREMENT_ID - Value: Your actual GA4 Measurement ID
- Name:
The analytics system tracks the following events:
- Site visits: Automatic
- Theme changes:
theme_change(dark/light) - File export:
export(with format) - File import:
import(with format) - About modal view:
about_view - AI usage:
ai_usage(generate_content/insert_content) - Presentation Settings tabs:
presentation_tab(general/header-footer/background/plugins) - Fullscreen toggle:
fullscreen_toggle(on/off) - Authentication modal open:
auth_modal_open(login/signup) - Authentication attempt:
auth_attempt(login/signup) - Authentication error:
auth_error(login_error/signup_error) - Authentication mode switch:
auth_mode_switch(login/signup)
- Run the project:
npm run dev - Go to Google Analytics
- Check Real-time > Events to see events
- Analytics only works in production or with correct environment variable
- For local testing, use Google Analytics DebugView
- All events are implemented with user privacy in mind
- GDPR Compliant: User consent required before tracking begins
- Privacy Policy: Available at
/privacypage - IP Anonymization: Enabled by default for privacy protection
- Custom Implementation: Uses Next.js Script component (not third-party libraries) for full control
- Conditional Loading: Analytics scripts only load after user consent
- No External Dependencies: Reduces bundle size and security risks
- Optimized Loading: Uses Next.js
afterInteractivestrategy
GDPR compliance features:
- Consent Banner: Users see a consent banner on first visit
- Opt-in Required: Analytics only starts after explicit user consent
- Opt-out Option: Users can continue using the site without analytics
- Persistent Choice: User's consent choice is remembered
- IP Anonymization: IP addresses are automatically anonymized
- No Personal Data: No personal information is collected
- Local Storage: User content stays in their browser
- Transparent Policy: Clear privacy policy explains data usage