Problem
Design a User Behavior Tracking System that collects and analyzes user events from mobile and web applications across multiple products.
Functional requirements
-
Track user behavior events (e.g., page_view, click, purchase) across products.
-
Provide
client SDKs
(web + mobile) and
server-side API endpoints
for event collection.
-
Support two primary analytics use cases:
-
Dashboard queries
(interactive): fast response times for common metrics and slices.
-
Deep analytics / warehousing queries
: complex, ad-hoc queries over large historical data.
-
Support
data enrichment
, such as:
-
Reverse geolocation from IP/GPS
-
Compliance / policy tagging (e.g., PII flags, data residency constraints)
Non-functional requirements
-
Low latency
for dashboard queries.
-
Support
asynchronous
execution for complex analytics queries.
-
(Assume typical production needs) reliability, scalability, schema evolution, and access control.
Deliverables to cover in your design
-
High-level architecture and main components.
-
Data model / event schema and how you handle schema evolution.
-
Ingestion pipeline (SDK → backend) with reliability guarantees.
-
Storage choices for dashboard vs warehouse queries.
-
Enrichment design (real-time vs batch) and how enriched data is served.
-
Key tradeoffs, bottlenecks, and operational concerns (monitoring, data quality, privacy).