SevyDevy

Design an ad click aggregation system

PremiumData pipelineHard

  • Exactly once
  • Click deduplication
  • Stream processing

Quick answer

This data pipeline interview question asks you to design an ad click aggregation system. Aim for a design that moves data from sources to consumers reliably and on time, then explain ingestion, processing, storage and trade-offs. Interviewers want to see how you handle volume, late or bad data and failures along the way.

The problem

Design an ad click aggregation system: it counts every click on every ad per minute, so advertisers see near-real-time dashboards and are billed for valid clicks, at 1 billion clicks a day. The hard parts are counting each click exactly once, filtering duplicates and fraud, and matching a full recount for billing.

Advertisers pay per click, so an overcount is overbilling and an undercount is lost revenue. The ad server is given: when a user clicks, it logs a click event and redirects the user to the advertiser's site.

What must an ad click aggregation system do?

  • Count clicks: Count valid clicks per ad per minute, and roll them up by campaign, advertiser, country and device.
  • Query: Advertisers query click counts for their ads or campaigns over a time range at minute, hour or day granularity.
4 more requirementsUnlock to see all

How well must it do it?

  • Accuracy: Final daily billable counts must exactly equal a full batch recount of the raw clicks.
  • Freshness: Dashboard counts appear within 1 minute of the click; small later corrections are fine.
3 more requirementsUnlock to see all

What scale should you design for?

Use these numbers in your estimates.

The scale numbers unlock with this questionUnlock

Key concepts

  • Exactly once
  • Click deduplication
  • Stream processing
  • Kafka
  • Tumbling windows
  • Reconciliation

How you’ll practise

6 short steps · save and come back any time
  1. Requirements
  2. Data volume
  3. Ingestion
  4. Storage and processing
  5. Serving and freshness
  6. Wrap-up

Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.

What do interviewers look for?

In any data pipeline design round.

  • Clarifies sources, consumers and freshness needs
  • Chooses batch, streaming or both with reasons
  • Handles late, duplicate and malformed records
  • Makes each stage safe to retry
  • Explains storage formats and partitioning
  • Plans monitoring, backfills and data quality checks

Questions people ask about this interview question

Which design type is this question?
It is a data pipeline question. You design an ad click aggregation system and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Hard. It suits engineers preparing for senior interviews, where you are expected to drive the discussion and go deep on trade-offs.
What should I cover first?
Start with the data sources, the consumers and how fresh the data must be. Agree on scope with the interviewer before you design anything.
Can I practise it for free?
It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.

Related questions

Updated · Written by the SevyDevy team

Premium questionSign up free, then unlock it