Implemented User Activity Tracking#368
Merged
A6dulmalik merged 2 commits intoMindBlockLabs:mainfrom Mar 26, 2026
Merged
Conversation
|
@KAMALDEEN333 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User Activity Tracking Middleware for Analytics
Description:
Create middleware to track user activity and behavior patterns for analytics, engagement metrics, and personalization.
Requirements:
Track user actions:
Page/endpoint accessed
Action performed (puzzle solved, profile updated)
Time spent on activity
Success/failure of action
Device and platform information
Store activity data in analytics database (separate from main DB)
Support real-time activity streaming to analytics service
Track anonymous users via session tokens
Link activities to user accounts when authenticated
Calculate engagement metrics:
Daily active users (DAU)
Weekly active users (WAU)
Average session duration
Feature usage statistics
Support activity filtering and querying
Privacy-compliant tracking (GDPR, CCPA)
Opt-out mechanism for privacy-conscious users
No impact on request performance (async processing)
Acceptance Criteria:
All significant user actions tracked automatically
Activity data stored asynchronously (no request delay)
Analytics queryable via separate API endpoints
User privacy preferences respected (opt-out honored)
Anonymous and authenticated tracking both work
Activity data retained per privacy policy (e.g., 90 days)
Real-time dashboard shows current active users
Historical analytics available for trend analysis
No PII (personally identifiable information) logged unnecessarily
Performance impact negligible (<2ms added latency)
Events to Track:
User authentication (login, logout, signup)
Puzzle interactions (started, submitted, completed)
Daily quest progress
Category browsing
Profile updates
Social interactions (friend requests, challenges)
Achievement unlocks
Point redemptions
Activity Data Structure:
{
userId or sessionId,
eventType, eventCategory,
timestamp, duration,
metadata (action-specific data),
device, platform, browser,
geolocation (city/country level only)
}
Privacy Compliance:
Respect Do-Not-Track headers
Honor user opt-out preferences
Anonymize IP addresses (last octet removed)
No cross-site tracking
Data retention limits enforced
closes #321