Brain-Storm uses a privacy-respecting event taxonomy for tracking user interactions across the platform.
| Category | Description |
|---|---|
discovery |
Course/instructor discovery and search |
profile |
User profile views and updates |
enrollment |
Course enrollment and progress |
tip |
Tip transactions |
review |
Review submissions and votes |
credential |
Credential issuance and verification |
auth |
Authentication events |
discovery_page_view- User views a pagediscovery_search- User performs a searchdiscovery_course_view- User views a course detaildiscovery_instructor_view- User views an instructor profile
profile_view- User views a profileprofile_update- User updates their profile
enrollment_start- User starts a course enrollmentenrollment_complete- User completes a coursecourse_progress_update- Progress percentage updates
tip_initiated- User initiates a tiptip_sent- Tip is successfully senttip_received- Tip is received (server-side only)
review_submitted- User submits a reviewreview_voted- User votes on a review
credential_issued- Credential is issued on-chaincredential_verified- Credential is verified
auth_login- User logs inauth_logout- User logs outauth_register- User registers
interface AnalyticsEvent {
eventId: string; // UUID
eventType: EventType; // From CORE_EVENTS
timestamp: string; // ISO 8601
userId?: string; // Anonymized user ID
sessionId: string; // Session UUID
source: 'web' | 'mobile' | 'api';
locale?: string; // Browser locale
payload: Record<string, unknown>; // Event-specific data (no PII)
}The following fields are never included in analytics events:
- email, name, fullName, firstName, lastName
- phone, address, dateOfBirth
- password, secret, token, privateKey
analyticsconsent is required for all events except marketingmarketingconsent is required for tip-related events
Consent is managed via:
- Backend:
EventsService.setConsent(userId, consent) - Frontend:
analytics.setConsent({ analytics: boolean, marketing: boolean })
- Analytics events are retained for 90 days
- Automatic cleanup runs daily at 3 AM UTC
import { analytics, trackEvent, CORE_EVENTS } from '@/lib/analytics';
// Track a specific event
analytics.trackCourseView('course-123', 'Solidity Basics');
// Or use trackEvent directly
trackEvent(CORE_EVENTS.ENROLLMENT_START, { courseId: '123' });Events are automatically captured via NestJS event emitter:
this.eventEmitter.emit('enrollment_start', { userId, courseId });Admin dashboards available at /v1/admin/analytics with:
- Date range filtering
- Growth metrics
- Tip volume
- Dispute rate
- CSV export
The admin dashboard provides:
totalUsers- Platform-wide user counttotalCourses- Published courses counttotalEnrollments- All enrollmentstotalCompletions- Completed coursescompletionRate- Percentage of completionsaverageRating- Average course ratingactiveWorkers- Users active in last 30 daystipVolume- Total tips in perioddisputeRate- Percentage of disputed transactionsgrowth- User growth percentage vs previous period