KatInterview

Analytics Platform for Page Traffic and User Conversion

System DesignModel answer
MediumModel answerSystem Designanalyticsstreamingdata-pipeline

Last updated

Build a metrics pipeline that tracks popular pages and calculates signup conversion rates with clear event semantics and late-arrival handling.

You're building an analytics platform for a content website that needs to answer two key questions:

  1. Which pages attract the most traffic?
  2. What percentage of visitors convert to paid subscribers?

Design the system architecture and define the metric semantics to support these queries reliably.

Requirements

Traffic Rankings

Your system must identify the top pages by activity over arbitrary time ranges. Consider what constitutes a distinct "page" and a countable "visit."

Conversion Metrics

Calculate the rate at which users move from initial engagement to paid subscription. Define which users belong in your measurement cohort and how you attribute subscriptions to prior activity.

Key Design Questions

  • Event identity: How do you distinguish unique pages when URLs contain tracking tokens, language codes, or session IDs?
  • Visitor counting: Should metrics reflect total hits, unique sessions, or distinct users?
  • Conversion attribution: When a user subscribes three days after their first visit, which cohort owns that conversion?
  • Data integrity: How do you handle bot traffic, duplicate events, network retries, and events that arrive hours late?
  • Query flexibility: Users want rankings for "last 7 days" or "this month"—how does your aggregation strategy support this?

Deliverables

Describe your event schema, storage architecture, aggregation logic, and how analysts would query and interpret results. Address accuracy versus performance trade-offs and common misinterpretation risks.

Hints

Hint 1

Start by defining canonical event types with timestamps, user identifiers, and context. Separate raw event ingestion from computed metrics.

Hint 2

For URL rankings, normalize away irrelevant parameters early. Precompute counts at multiple granularities (hourly, daily) to serve queries efficiently.

Hint 3

Conversion requires joining two event types across time. Use windowed lookups or materialized user timelines, and decide whether late conversions update past cohorts or only future reports.