Skip to content

Feature/analytics intelligence engine#133

Open
Ritesh2332 wants to merge 4 commits into
Dev-Card:mainfrom
Ritesh2332:feature/analytics-intelligence-engine
Open

Feature/analytics intelligence engine#133
Ritesh2332 wants to merge 4 commits into
Dev-Card:mainfrom
Ritesh2332:feature/analytics-intelligence-engine

Conversation

@Ritesh2332
Copy link
Copy Markdown

Summary

This PR introduces a live engagement analytics tracking system for public profile and card views.

The implementation adds a centralized analytics event architecture using Prisma models and reusable tracking services while preserving backward compatibility with the existing CardView tracking system.

The new analytics layer enables scalable event-driven tracking for future analytics dashboards, engagement insights, and conversion funnel features.

Closes #


Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • Added new EngagementEvent analytics model to Prisma schema
  • Added analytics database migration for engagement event storage
  • Added centralized trackEvent() analytics service
  • Added privacy-safe IP hashing using SHA-256
  • Added typed analytics event architecture with reusable event types
  • Integrated live analytics tracking into public profile routes
  • Integrated live analytics tracking into public card routes
  • Preserved backward compatibility with existing CardView tracking system
  • Added structured metadata support for future analytics expansion

How to Test

  1. Start services:
docker compose up -d
  1. Run backend:
pnpm dev
  1. Open a public profile route:
http://127.0.0.1:3000/api/u/<username>
  1. Verify analytics events are stored:
SELECT event_type, source, metadata
FROM engagement_events;

Checklist

  • My code follows the project's coding style
  • TypeScript compiles for the added analytics layer
  • No debug statements or console logs were left in the code
  • Existing functionality remains backward compatible
  • Database migrations were successfully applied

Additional Context

This PR lays the foundation for future analytics features such as:

  • profile engagement dashboards
  • card performance tracking
  • QR analytics
  • traffic aggregation
  • conversion funnels
  • unique visitor insights

@Harxhit Harxhit added the gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants