In this article
  1. Before you start
  2. Why interviewers ask this
  3. Ads and marketplaces from first principles
  4. Worked example
  5. Trade-offs and edge cases
  6. How to answer it in an interview
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

This page sits in the product and analytics case guide, and the product management guide covers the wider round, because these questions are asked in product and data rounds. It assumes no advertising background.

Why interviewers ask this

Domain questions check whether you can reason inside a business you have not worked in. The prompts arrive as "what data models do you need for an advertiser to start a campaign and show ads", "how do you model frequency capping", "how do you capture revenue numbers" and "how would a seller see their own rating". Each looks like a schema question, and each hides a decision about speed, correctness or fairness.

A weak answer lists tables. A strong answer names the entities, says which lookup must be fast and which can be slow, states what is counted exactly once, and says what the business does with the number. Interviewers in product, analytics and data roles use these questions because the vocabulary can be learned in an afternoon but the habit of tying it to a design cannot be faked. The sections below teach the vocabulary from zero and then the habit.

Ads and marketplaces from first principles

In plain words

Impression
An impression is a single showing of an ad to one person, and the basic unit that ad platforms count and charge by.
Generalized second-price auction
A generalized second-price (GSP) auction is how search engines sell ad slots. Bidders are ranked, and each winner pays about what it takes to beat the bidder below it.
Frequency cap
A frequency cap is a limit on how many times the same person sees the same ad or campaign in a set period, such as 3 times a day.
Two-sided marketplace
A two-sided marketplace is a platform where two groups, such as buyers and sellers, find each other.

Think of an ad platform as a shop window with a few front-row seats. Many advertisers want a seat, so the platform runs a quick auction every time a person looks. The analogy breaks in one place. A shop window serves one passer-by at a time, but the platform runs a fresh auction for every page view of every person and keeps a per-person count while it does.

Three prices appear in every answer. Cost per thousand impressions (CPM) charges for views. Cost per click (CPC) charges only when someone clicks. Cost per action charges when a person buys or signs up. The online advertising article defines all three.

A marketplace adds two ideas. Sellers need buyers and buyers need sellers, which the two-sided market article, last edited in October 2026, calls cross-side network effects. And trust matters, which ratings carry.

Step 1: Model who owns what

The question "what data models do you need for an advertiser to start a campaign and show ads?" asks for the ownership chain. An advertiser owns campaigns. A campaign holds a budget, dates and a status. Inside it sit ad groups, each with a bid, a bid type and targeting rules. Each ad group holds ads, the creatives people see, and each ad has a review status because platforms check ads before showing them.

Draw it as four tables with foreign keys: advertiser, campaign, ad group, ad. Put the budget on the campaign, because that is the unit the advertiser spends against, and the bid on the ad group, because that is the unit the auction reads. The input is an advertiser's setup form; the output is rows that the auction can read without joining more than two tables. You now have the supply side, and step 2 chooses which ad wins.

Step 2: Pick the ad with an auction

Each time a person is about to see an ad slot, the platform collects every ad eligible for that person, ranks them and charges the winner. Google's Ad Rank page says Ad Rank is a set of values used to decide whether ads are eligible to show, and lists the bid, the quality of the ad and landing page, thresholds, auction competitiveness, the person's context and the expected effect of ad assets. So rank is not the bid alone.

The classic paper is the Edelman, Ostrovsky and Schwarz paper (2007), which studies the generalized second-price auction and notes that, unlike the single-item Vickrey auction, it generally has no equilibrium in dominant strategies, so bidding your true value need not be best. In an interview, say: rank by bid times a quality estimate, and charge the minimum that keeps the position. The input is the eligible ads; the output is a ranked list with a price per click. You now know how the winner is chosen; step 3 limits how often one person sees an ad, and drops capped ads before this ranking.

Step 3: Cap how often one person sees an ad

"How do you model frequency capping?" is the heart of the page. The cap is counted per person, per campaign, per period. Google's frequency capping page says it allows you to "limit the number of times ads appear to the same person", that for display campaigns only viewable impressions count, and that for video you choose a daily, weekly or monthly interval.

The trap is where you count. The impression log is large, append-only and written after the fact, so querying it before each ad is far too slow. Keep a small counter table keyed by campaign, user and day. Read it while collecting eligible ads, so a capped ad drops out before ranking and never wastes the slot.

Then count the winner with one atomic conditional step, "insert a row, or on conflict add 1 only where the count is below the cap", and serve only if a row changed. A separate read then increment has the same burst race as the log. The log stays the audit record, reconciled by a periodic job. The input is the eligible ads and a user key; the output is a shortlist without capped ads, then serve or skip. You now keep repeats bounded, so step 4 counts what happened.

Step 4: Count events once and tie revenue to them

"How do you capture revenue numbers?" has a short correct shape: record each event, then derive money from events, not the other way round. Each impression and click is an event row with a time, the ad, the user key and a charged amount. Revenue by day is a sum over charged amounts, and the unit decides the formula: a CPM campaign earns impressions divided by 1,000 (illustrative thousands) times the rate, and a CPC campaign earns the clicks times the rate. To compare them, convert to an effective cost per thousand impressions (eCPM): the click rate times the price per click, times 1,000.

Idempotency matters: the same click can arrive twice from a retrying client, so each event gets a unique id and the table refuses duplicates. Invalid traffic is flagged, not deleted, so billing can reverse it. The input is a stream of events; the output is revenue you can reconcile. You now have the whole ad loop, and step 5 turns to the marketplace.

Step 5: Rate sellers without rewarding small samples

"How do you see your own marketplace rating?" sounds like a screen but is a data question. A review row belongs to one order, names the buyer and the seller, and holds a star value; a seller's own rating is a query over reviews where the seller is the logged-in account, and the same query with a different filter feeds the public listing. One review per order, enforced by a unique key on the order, stops a buyer rating twice.

Showing a rating is a fairness decision, not just an average. A seller with five perfect reviews should not outrank one with 200 reviews at 4.8 (illustrative), so the platform shrinks each average toward a prior mean, weighing the prior like a number of reviews. The input is the review rows; the output is a score that ranks sellers. You now have every piece, and the worked example puts numbers on them.

Five pieces of data design behind ads and a marketplaceFive boxes added one at a time: model the campaign tables, run the auction, check the frequency counter, record events and revenue, and rate sellers in the marketplace.Model the campaignadvertiser, campaign, adgroup, adRun the auctionbid times qualityCap repeatsatomic counter bycampaign, user, dayCount events andrevenueunique event idsRate sellersshrunk averageDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/ads-and-marketplace-domain-questions.html

Five pieces of data design sit behind an ad platform and its marketplace, and each answers one interview question.CC BY 4.0 — source: Ads and marketplace domain questions, explained from zero
Step-by-step description
  1. Four linked tables hold the campaign.
  2. Rank by bid times quality.
  3. Count atomically; capped ads drop out before ranking.
  4. Store events once; derive revenue.
  5. Shrink seller ratings toward the mean.
  • A campaign is modelled as advertiser, campaign, ad group and ad tables.
  • A per-user counter, read while collecting eligible ads, enforces the frequency cap.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

Worked example

All names and numbers are invented and illustrative, and every result was produced by a short script that also ran the schema in an in-memory Structured Query Language (SQL) database.1

The schema for steps 1 to 3 reads, in part:

create table campaign (campaign_id integer primary key, advertiser_id integer not null,
  daily_budget_cents integer not null, status text not null default 'draft');
create table ad_group (ad_group_id integer primary key, campaign_id integer not null,
  bid_cents integer not null, bid_type text check (bid_type in ('cpm','cpc','cpa')));
create table freq_counter (campaign_id integer, user_id text, day text,
  impressions integer not null default 0, primary key (campaign_id, user_id, day));

The campaign and ad group tables hold the budget and bid the auction reads. The counter table uses one row per campaign, user and day, so the cap check is a single primary-key lookup while collecting eligible ads. The count itself is one atomic statement on that key:

insert into freq_counter values (10, 'u1', '2026-03-02', 1)
on conflict (campaign_id, user_id, day)
do update set impressions = impressions + 1 where impressions < 3;

If the statement changes a row, the ad is served; if it changes none, the cap is reached and the ad is skipped. The check and the increment cannot be separated, so a burst cannot slip past.

One cap of 3 served 3 of 5 requests, a lower bidder won the auction, and the 200-review seller ranked first after shrinking.
FactValue
Winning advertiser (bid times quality)B, bid 1.50, quality 0.9
Highest bidder's positionD bid 3.00 and ranked 4th
Price per click B pays1.12, less than its 1.50 bid
Frequency cap, 5 requests at a cap of 33 served, 2 skipped, counter ends at 3
CPM revenue, 1,200,000 impressions at 4.505,400.00
CPC revenue, 9,600 clicks at 0.565,376.00, an eCPM of 4.48
Seller with 5 reviews at 5.0, shrunk4.36 (rank 3)
Seller with 200 reviews at 4.8, shrunk4.745 (rank 1)

The auction. Four advertisers bid per click: A bids 2.00 with quality 0.5, B bids 1.50 with 0.9, C bids 1.20 with 0.8 and D bids 3.00 with 0.2. Multiplying bid by quality gives rank scores of 1.00, 1.35, 0.96 and 0.60, so the order is B, A, C, D, and the highest bidder D comes last.1 The price rule is the next rank score divided by your own quality, plus one cent.

B must beat A's score of 1.00, so B pays 1.00 / 0.9 + 0.01 = 1.121, rounded to 1.12, below its own bid of 1.50. A pays 0.96 / 0.5 + 0.01 = 1.93, and C pays 0.60 / 0.8 + 0.01 = 0.76.1 There are 3 slots, so D ranks fourth, gets no slot and pays nothing; its 0 in the chart means "not shown", not "free". This is a simplified teaching rule: Google's page lists more factors in Ad Rank than bid and quality, and does not publish a formula.

The highest bidder got no slot and the winner paid lessGrouped bars for advertisers A to D: bids of 2.00, 1.50, 1.20 and 3.00, and prices per click of 1.93, 1.12, 0.76 and 0 for D, which ranks fourth of 3 slots and pays nothing. Advertiser B wins on bid times quality and pays 1.12.Per click0123ABCDAdvertiser (A-D, illustrative)BidPrice per click (D: no slot)winsno slotDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/ads-and-marketplace-domain-questions.html
The highest bid got no slot: rank used bid times quality, 3 slots were on offer, and the winner paid less than its bid.CC BY 4.0 — source: Ads and marketplace domain questions, explained from zero
Text description of the diagram
  • Advertiser D bids 3.00, ranks fourth, gets none of the 3 slots and pays nothing.
  • Advertiser B wins with a bid of 1.50 and pays 1.12 per click.

The cap. One user requests five ad slots in a day against a cap of 3. The atomic counter statement lets the first three through and changes no row for the last two, ending at 3, and the event table holds exactly 3 impression rows.1 The counter and the log agree, which is what the reconciliation job would verify.

The revenue. 1,200,000 impressions at a CPM of 4.50 earn 5,400.00. At a click rate of 0.8 percent that is 9,600 clicks, and at 0.56 per click they earn 5,376.00, so the two pricing models are within half a percent of each other, an eCPM of 4.48 against 4.50.1

The ratings. Three sellers: one with 5 reviews at 5.0, one with 200 at 4.8 and one with 40 at 4.6 (illustrative). Raw averages rank them 5.0, 4.8, 4.6. Shrinking toward a prior mean of 4.2 with a weight of 20 reviews uses (20 x 4.2 + n x average) / (20 + n). For the five-review seller that is (84 + 25) / 25 = 4.36; the others give 4.745 and 4.467, so the 200-review seller moves from second to first and the five-review seller from first to third.1

Shrinking ratings moves five perfect reviews from first to thirdGrouped bars for three sellers: raw averages of 5.0, 4.8 and 4.6 against shrunk averages of 4.36, 4.745 and 4.467. The seller with 200 reviews ranks first after shrinking.Stars44.555 reviews200 reviews40 reviewsSeller (number of reviews)Raw averageShrunk averageranks firstDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/ads-and-marketplace-domain-questions.html
A raw average rewards few reviews; shrinking toward the mean puts the 200-review seller first.CC BY 4.0 — source: Ads and marketplace domain questions, explained from zero
Text description of the diagram
  • The seller with 5 reviews at 5.0 scores 4.36 after shrinking.
  • The seller with 200 reviews at 4.8 scores 4.745 and ranks first.

Trade-offs and edge cases

The designs above are the textbook ones, and each has a place where it bends.

Exact caps against fast caps

A per-user counter in a distributed system can lag: two servers each read 2 and each serve once, giving 4 against a cap of 3. Platforms accept a small overshoot to avoid a lock on every request, or route each user to one counter shard. Say which you chose and what overshoot you tolerate. The system design guide covers the sharding choice.

What counts as an impression

Definitions change money. Google says that for display campaigns only viewable impressions count toward frequency caps, which means an ad that loaded off-screen is not counted. When an interviewer asks about revenue numbers, ask which definition the contract uses, because the same traffic yields different totals.

Who the marketplace serves first

A two-sided marketplace must attract both groups, and the two-sided market article notes that cross-side effects can be negative as well as positive, as when consumers dislike advertising. A rating system therefore trades fairness to sellers against clarity for buyers, and ranking by raw average is the simplest version of getting that wrong. The recommender systems guide covers ranking more generally.

How to answer it in an interview

Interviewer asks

What data models do you need for an advertiser to start a campaign and show ads?

A strong answer

Four tables with foreign keys: advertiser, campaign, ad group and ad. The campaign holds budget, dates and status, the ad group holds the bid and targeting, and the ad holds the creative with a review status. At serve time I rank eligible ads by bid times a quality estimate and charge the minimum that holds the position. A small counter keyed by campaign, user and day is read while collecting eligible ads, so capped ads never reach the auction, and the winner is counted with one atomic conditional upsert so a burst cannot exceed the cap. An append-only event table records impressions and clicks, so revenue is a sum over events with unique ids.

The spoken structure is: name the entities, say what is read at serve time, say where each count lives, then say how money is derived.

Common mistakes

  • "Rank by highest bid" (wrong). The highest bidder can rank last when quality is low (right: rank by bid times a quality estimate, as Google's Ad Rank factors imply).
  • "Check the cap by counting rows in the impression log" (wrong). The log is too slow and lags behind bursts (right: keep a counter keyed by campaign, user and day, increment it atomically, and reconcile it with the log).
  • "Revenue is a column we increment" (wrong). A bare counter cannot be audited or reversed (right: store events with unique ids and derive revenue from them).
  • "Show the average star rating" (wrong). Five perfect reviews would outrank 200 good ones (right: shrink toward a prior mean, or show the count beside the score).
  • "One table for everything" (wrong). Budget, bid and creative change on different schedules (right: split campaign, ad group and ad).

Follow-up questions

What data models do you need for an advertiser to start a campaign and show ads?

Advertiser, campaign, ad group and ad tables linked by foreign keys, plus a counter table for frequency and an event table for impressions and clicks. Put the budget on the campaign and the bid on the ad group.

How do you model frequency capping?

Keep a counter keyed by campaign, user and day. Read it while collecting eligible ads so capped ads drop out before ranking, and count the winner with one atomic conditional upsert. Treat the impression log as the audit trail and reconcile the two periodically.

How do you capture revenue numbers?

Record every impression and click as an event with a unique id and a charged amount, then sum by day. The unit decides the formula: impressions divided by 1,000 times the CPM, or clicks times the CPC.

How do you see your own marketplace rating?

Query the review table for rows where the seller is the logged-in account, and show the average with the review count. The public ranking uses the same rows with a shrunk average so few reviews cannot dominate. The probability and statistics guide explains why small samples mislead, and the machine learning system design guide shows how quality estimates enter ranking.

Why does the highest bidder not always win the ad slot?

Because rank combines the bid with a quality estimate and other factors. In the example, advertiser D bid 3.00 but ranked fourth with a score of 0.60, while B won at 1.50.

Key takeaways
  • Model advertiser, campaign, ad group and ad as four linked tables, with budget on the campaign and bid on the ad group.
  • Rank ads by bid times quality, not bid alone, and charge the minimum that keeps the position.
  • Count frequency caps in a small per-user counter, and keep the event log as the audit record.
  • Derive revenue from events with unique ids, and say which impression definition the contract uses.
  • Shrink seller ratings toward the mean so a handful of reviews cannot top the ranking.

Sources

  1. About Ad Rank (Google Ads Help) — Google (no page date shown; date = read date), 24 Oct 2026
  2. About frequency capping (Google Ads Help) — Google (no page date shown; date = read date), 24 Oct 2026
  3. Internet Advertising and the Generalized Second-Price Auction — American Economic Review 97(1), Edelman, Ostrovsky and Schwarz; year and month only, 1 Mar 2007
  4. Vickrey auction — Wikipedia (last edited date), 17 Feb 2026
  5. Two-sided market — Wikipedia (last edited date), 14 Oct 2026
  6. Online advertising — Wikipedia (no last-edited date retrieved; date = read date), 24 Oct 2026