Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
4.2 KiB
4.2 KiB
Phase 2: Usage Analytics Implementation Summary
Completed Tasks
1. Ticket Operations Analytics ✅
- Ticket Creation: Tracks ticket type, priority, categories, assignment status, creation method (manual vs from asset)
- Ticket Updates: Tracks fields updated, status changes, assignments, and resolution time
- Ticket Resolution: Tracks time to resolution, priority, category, and assignment status
- Ticket Assignment: Tracks reassignments and time to first assignment
- Ticket Deletion: Tracks age of ticket and resolution status
- Ticket Search: Tracks search queries, filters used, result counts
- Ticket Comments: Tracks internal vs external comments, resolution comments
2. Authentication Analytics ✅
- Login Success: Tracks provider (Google, credentials, Keycloak), user type, 2FA status
- Login Failures: Tracks failure reasons (inactive account, invalid password)
- User Registration: Tracks registration method, user type, company creation
- User Logout: Tracks user type on logout
- OAuth Failures: Tracks Google OAuth failures for inactive accounts
3. Search Functionality Analytics ✅
- Ticket Search: Query length, search fields, filters applied, result count
- Search Performance: Integrated into TicketService
4. API Performance Tracking ✅
- Analytics Middleware: Created middleware to track API request performance
- Slow Query Detection: Flags requests over 1s, tracks separately if over 2s
- Error Tracking: Captures API errors with endpoint and error type
- Performance Decorator: For tracking slow operations in services
Analytics Events Implemented
Ticket Events
ticket_created- When a new ticket is createdticket_updated- When ticket fields are modifiedticket_resolved- When ticket status changes to closedticket_assigned- When ticket is assigned or reassignedticket_deleted- When a ticket is deletedticket_searched- When tickets are searchedticket_comment_added- When comments are added
Authentication Events
user_logged_in- Successful loginuser_logged_out- User logoutuser_signed_up- New user registrationlogin_failed- Failed login attemptsauth_validated- Successful credential validation
Performance Events
api_request- All API requests with durationslow_query- Queries exceeding 2s thresholdapi_error- API request failuresslow_operation- Service operations over 500msoperation_error- Service operation failures
Key Features Implemented
-
Privacy-First Approach
- No PII in events
- Anonymized IDs for on-premise
- Aggressive sanitization
-
Performance Metrics
- Request duration tracking
- Slow query detection
- Error rate monitoring
-
User Journey Tracking
- Login methods and providers
- Feature usage patterns
- Error recovery paths
-
Deployment-Aware
- Different data collection for hosted vs on-premise
- Respects ALGA_USAGE_STATS environment variable
Next Steps
Remaining Phase 2 Tasks:
- Time Tracking Analytics - Track time entry creation, updates, timesheet submissions
- Billing Operations - Track invoice generation, payment processing, billing rules
- Testing - Verify all analytics events are firing correctly
- Documentation - Complete analytics event reference
Phase 3 Preview:
- User cohorts and segmentation
- Conversion funnels
- A/B testing framework
- Advanced dashboards in PostHog
Usage Examples
// Ticket creation with analytics
analytics.capture(AnalyticsEvents.TICKET_CREATED, {
ticket_type: 'manual',
priority_id: ticket.priority_id,
has_description: true,
created_via: 'web_app'
}, userId);
// API performance tracking
@trackPerformance('search_tickets')
async search(data: SearchData) {
// Method implementation
}
// Login tracking
analytics.capture(AnalyticsEvents.USER_LOGGED_IN, {
provider: 'google',
user_type: 'msp',
has_two_factor: true
}, userId);
Testing Analytics
To test the implementation:
- Set
ALGA_USAGE_STATS=truein your environment - Perform actions (create tickets, login, search)
- Check PostHog dashboard for events
- Verify no PII is being sent
- Test opt-out with
ALGA_USAGE_STATS=false