Skip to content

Instantly share code, notes, and snippets.

@MuhammadQuran17
Created February 18, 2026 06:42
Show Gist options
  • Select an option

  • Save MuhammadQuran17/b9d6cca6c1e128fbe521a34cc4d7adf3 to your computer and use it in GitHub Desktop.

Select an option

Save MuhammadQuran17/b9d6cca6c1e128fbe521a34cc4d7adf3 to your computer and use it in GitHub Desktop.
Advertisement Wisdom

To show ad there is Auction

It happens incredibly fast—usually, the entire process takes between 100 and 200 milliseconds (that’s faster than the blink of an eye). When you open an app or a webpage, a whole technological drama unfolds behind the scenes. 🎭

This process is called RTB (Real-Time Bidding).

The Main Players 🏟️

To make millions of auctions work, a specific infrastructure exists:

  • SSP (Supply-Side Platform): Software on the publisher’s (your) side. It "puts up for sale" an ad slot and says: "I have a user here from Tashkent, iPhone 15, likes gaming."
  • DSP (Demand-Side Platform): Software on the advertisers' side. It contains thousands of ads and settings like: "I want to show sneaker ads to men aged 20–30 and I’m willing to pay up to $1 per click."
  • Ad Exchange: The marketplace where the SSP and dozens of different DSPs meet to conduct the auction.

How the Auction Works (Step-by-Step) ⏱️

  1. The Request: As soon as the page starts loading, the SSP sends a request to the exchange with data about the user.
  2. The Evaluation: The exchange sends this request to all DSPs. Each DSP checks its database in a fraction of a second: does this person fit their advertisers' requirements?
  3. The Bid: If there’s a match, the DSP places a bid. This is where pCTR comes into play—the system calculates: "Bid is $1, click probability is 5%, so the expected revenue (eCPM) is $50. I’m bidding!"
  4. Selecting the Winner: The exchange collects all bids, picks the highest one, and passes the banner to the winner.
  5. The Impression: The ad is rendered on the screen.

pCTR

pCTR (predicted Click-Through Rate) was introduced so that the advertising system could make decisions instantly, without waiting for actual clicks to happen.

Imagine that every second, millions of auctions take place for the right to show an ad. If the system relied only on historical (past) CTR, it wouldn't be able to effectively handle new ads that don't have statistics yet, or account for a specific user's current context in real-time.

Remember how we discussed that it’s more profitable for the publisher (you) to show the ad with the higher eCPM? The ad network uses pCTR to calculate the "expected" eCPM before the impression even occurs.

eCPM

eCPM is, essentially, a universal measurement of revenue. It is needed to compare the effectiveness of different advertisements or ad networks, even if they operate under completely different payment schemes.

Imagine this situation:

  • One advertiser pays you for clicks (CPC).

  • Another pays only for app installs (CPI).

  • A third pays simply for the ad being shown (CPM).

Comparing the price of a click to the price of an install is like comparing meters to kilograms. eCPM brings everything to a common denominator: it shows how much money 1,000 impressions of each of these ads generated (or could have generated).

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment