Proje: Okul B2B App · Hub: Okul B2B App — Conventions

Analytics Event Tracking Kullanım Kılavuzu

Import Pattern

import {
  trackLeadEvent,
  trackGalleryEvent,
  trackAuthEvent,
  trackOrganizationEvent,
  trackDashboardEvent,
  trackProfileEvent,
  trackContentEvent,
  trackScreenView,
  setUserProperties,
  trackPerformance,
} from '@/services/AnalyticsEvents';

Her Event Fonksiyonu

// Lead event
await trackLeadEvent('view', { lead_id: 123 });
await trackLeadEvent('status_change', { lead_id: 123, lead_status: 'contacted' });
 
// Gallery event
await trackGalleryEvent('add_photo', { school_id: 456, photo_count: 5 });
 
// Auth event
await trackAuthEvent('login', 200, { method: 'credentials', user_id: '789' });
 
// Organization event
await trackOrganizationEvent('company_select', 123, 'company', { auto_selected: true });
 
// Screen view (otomatik: useScreenTracking)
await trackScreenView({ screen_name: 'Anasayfa' });
 
// Performance
await trackPerformance('app_start', 1200, 200, { screen_name: 'initialization' });

setUserProperties (Login sonrası)

await setUserProperties({
  user_id: user.id.toString(),
  company_id: user.customer_id,
  user_type: 'staff',
  has_multiple_companies: false,
});

ZORUNLU KURAL

Her yeni özellik veya CRUD işleminde event ekle. CLAUDE.md’de zorunlu olarak belirtilmiştir.