Design an advertiser metrics tracking platform
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Amazon's technical phone screen, last asked May 2026. It tests ads, metrics and aggregation.
Design the object model and service interfaces for a platform that tracks performance metrics for advertisers. Ad events such as impressions, clicks and conversions arrive for campaigns; advertisers ask how their campaigns are doing (impressions, clicks, click-through rate, conversions, spend, cost per click or per acquisition) over a time range. New event types and new metrics should plug in without rewriting the core.
Requirements
- Functional: record events for an ad that belongs to a campaign that belongs to an advertiser.
- Functional: query metrics per advertiser, campaign or ad, over a time range, optionally by day.
- Functional: add a new event type (for example video views) or a new metric (for example view rate) by adding a class, not editing existing ones.
- Non-functional: correct counts when the same event arrives twice; state how the design would grow to high volume.
Clarifying questions
- Which event types and metrics are needed first?
- Do queries need real-time numbers, or is a few minutes' delay fine?
- How is a conversion attributed to a click: the last click, a time window?
- Can one advertiser see another's data in any form? (No, but say how that is enforced.)
- Is this in-memory for the interview, or should it show where storage would sit?
What a strong answer covers
- Classes and their responsibilities:
Advertiser,Campaign,Ad, anEventbase with subtypes (or an event type field), anEventIngestorthat validates and deduplicates by event id, anEventStoreor aggregate store, and aMetricsServicethat answers queries. - A
Metricinterface (for examplecompute(counts) -> float) with implementations such asClickThroughRateandCostPerClick, registered by name, so new metrics plug in. - Pre-aggregated counters per ad and time bucket so queries do not scan raw events; roll-ups to campaign and advertiser.
- Handling division by zero, late events landing in older buckets, and currency for spend.
- Access checks so an advertiser only queries their own campaigns.
- How it maps onto real systems at scale: a stream processor for aggregation and a columnar store for queries.
Follow-ups
- Add a new event type, video view, and a metric that uses it. What changes?
- The same click arrives twice. Where is it caught?
- An advertiser wants hourly numbers for the last 90 days. How does the storage change?
- How would you test the metric calculations?
Where it's asked
- Amazon · Technical phone screen · Last asked May 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI
What it tests
ads · metrics · aggregation
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.
