← Questions
Design view counting for product pages
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Uber's system design round, last asked Apr 2026. It tests counters, analytics and streaming.
Design view tracking for the product pages of a large online store. When a shopper opens a product page on the web or in the mobile app, the system records the view. Product pages may show view numbers such as total views or "viewed 120 times today", and sellers get analytics on their products' views.
Requirements
- Functional: record a view from web and mobile clients; report total views and unique viewers per product, over all time and recent windows (last hour, today).
- Functional: seller-facing analytics over longer periods.
- Non-functional: very high write volume, concentrated on a few popular products; reads on the product page must be fast; counts may lag by seconds to minutes but must not drift; bots and duplicate events must not inflate numbers; shopper privacy respected.
Clarifying questions
- What counts as one view: every page load, or one per shopper per product per time window?
- Which numbers are shown to shoppers, and which only to sellers? Must shopper-facing numbers be exact?
- How fresh must each number be?
- How many views per second at peak, and how skewed toward popular products?
- How long must raw events be kept, and what privacy rules apply?
What a strong answer covers
- Event collection on the client (beacon on page view, batched and retried) and on the server (logged when the page is served), and why you may want both.
- An event schema: event id, product id, viewer or device id, session, timestamp, platform, referrer; an idempotent ingest API.
- A pipeline: ingest into a durable log (Kafka or similar), stream aggregation into per-product counters, raw events into cheap storage for batch recomputation.
- Total views versus unique viewers: exact sets are too large, so HyperLogLog sketches per product and window, and how sketches merge across windows.
- Hot products: pre-aggregate in the stream processor or shard a counter across several keys, so no single row takes every write.
- Bot filtering and deduplication by event id and per-viewer windows; fraud such as sellers inflating their own views.
- Reads served from a cache in front of the counter store; monitoring of ingest lag, drop rates and counts against the batch job.
Follow-ups
- A product goes viral and gets 100× its normal views. Walk through what breaks first.
- Shoppers in one region must not be tracked without consent. What changes?
- The streaming counts and the nightly batch disagree by 3%. How do you find out why?
- Sellers want views broken down by traffic source and hour for the last year.
Where it's asked
- Uber · System design · Last asked Apr 202660 min · Whiteboard and discussion
What it tests
counters · analytics · streaming
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
