Ads Mediation Platform in a Nutshell
An ads mediation platform like Outbrain or Taboola acts as a marketplace that connects publishers (websites) and advertisers through a supply-and-demand model.- Publishers (Demand Side): These are websites that want to maximize revenue by displaying ads. They integrate native ad widgets (those āYou May Also Likeā sections) to monetize their content. Think of the publisher's website as the bedāitās the foundation where everything happens.
- Advertisers (Supply Side): They are spending money on campaigns to drive brand awareness, impressions, clicks, and ultimately, purchases. They place their ads on these publisher sites, using a bidding system to get the best placements. The ads are like the blanketāthey cover the bed, making it more appealing and valuable.
Because from mediation layer perspective, it is the Advertiser side supply the ads NOT content, or NOT exactly contents. Because audience goes to publisherās website for content NOT ads

How It Works (Supply & Demand)
- Demand: Publishers offer real estate (ad space) on their sites.
- Supply: Advertisers bid for these spots, aiming to attract users and drive conversions.
- Mediation & Optimization: Platforms like Outbrain/Taboola use algorithms to decide which ads to show, maximizing revenue for publishers and ROI for advertisers.
Core Formula
RPM = CPC * CTR
- RPM: revenue per mille (1000 impressions)
- CPC: cost per click
This is the major parameter advertiser could set and āfine tuneā to have their campaign to compete for ads spaces.
- CTR: click thru rate
This is determined by the ads format, actual content and audience.
Bed & Blanket Model
The Bed & Blanket model helps optimize ad placement by analyzing publisher inventory (the "Bed") and advertiser demand (the "Blanket") across different content categories. It ensures that the network can absorb more and better ad campaigns while maximizing revenue for both publishers and advertisers.- Bed (Publisher Inventory): Represents available ad impressions across different content categories.
- Blanket (Advertiser Demand): Measures the total potential impressions advertisers can generate for a category.
- The system identifies gaps where either more ads (Blanket) or more publisher content (Bed) is needed to balance supply and demand.
Actionable Insights: Blanket & Bed Strategies
For Amplify sales representatives and account managers. It provides optimal spend and CPC suggestions for each category, along with examples of top-performing articles and marketers in those areas. This empowers sales teams to target the most promising opportunities. For Publisher sales representatives, focusing on optimizing existing publisher inventory. It highlights potential revenue and RPM growth achievable by driving more page views to specific content categories. The tab also showcases top-performing publishers in each category, enabling sales teams to collaborate with them and unlock further potential.A little bit on Recommendation Engine
A good recommendation engine takes the RPM as the core rank factor, why? Because by doing so, we let CTR i.e. audience give the feedback whether content is good or not? Whether they click or not. On the other hand, it still allows Advertiser to toggle CPC i.e. their spending to signal whether they want a better ads space or more exposure or not?By maximizing revenue in a long run, Ads mediation should dance beautifully with both Publisher and Advertisers, to reward good content improve the CTR and optimize toward an ideal CPC!
A Calculator for Advertisers to get an optimal CPC
Internally, we build a small tools to help Advertiser to fly their campaign in following two scenarios:- Prospect: i.e. brand new campaign, with no history of their ads performance, they want know what initial CPC (CPC_initial) to start
- Existing: i.e. a campaign has been flying for a little while, they need look at their performance to tweak the CPC
Some advertisers especially with huge budget, sometimes will set extremely high CPC to offset the poor CTR to get high RPM, but that not necessarily work every time, because this might push your ads to wrong audience segments, then people still donāt click, which leads lower CTR. And as mediation layer, we donāt want them to do this either, because expose audience with wrong content hurts publisher and will hurt us.

$CPC Calculator - $CPA Taget Mododule

Existing Scenario
- Spend Target ā Ensuring a specific budget is spent efficiently over a set duration.
- CPA Goal (Cost Per Acquisition) ā Ensuring each conversion (purchase, sign-up, etc.) remains within a target cost.
1. CPC Calculation for Spend Goal
The script determines how much CPC should be adjusted to meet a given spending target over a specific time period:- It analyzes past campaign performance (CTR, conversions, CPC) over 7-21 days.
- It calculates the daily spend target based on pacing settings (e.g., spend ASAP vs. automatic adjustment).
- Uses percentiles of past CTR (Click-Through Rate) to estimate a range of possible CPC values.
- Adjusts CPC further based on competitive RPM (Revenue Per Thousand Impressions) to ensure the advertiser is bidding optimally against competitors.
- The final CPC range is set to maximize budget usage without drastically increasing cost.
2. CPC Calculation for CPA Goal
If the advertiserās main goal is a target Cost Per Acquisition (CPA), the script determines the optimal CPC that balances cost efficiency while still driving enough conversions:- It retrieves past Conversion Rate (CVR) and estimates future performance using percentiles (55th & 85th).
- It derives an initial CPC based on CPA = CPC Ć· CVR.
- Adjusts the CPC range using RPM constraints, ensuring it aligns with revenue expectations.
- The final optimal CPC range is the intersection of CPA and RPM-driven values, ensuring the advertiser stays profitable while scaling.
Prospect Scenario
1. CPC Calculation for CPA Goal
When the advertiser wants to achieve a specific Cost Per Action (CPA), the model:- Sets a baseline CPA within a reasonable range (e.g., $1 to $500).
- Retrieves past conversion performance by country, advertiser type, and content category.
- Adjusts conversion rate (CVR) discounts based on device type (desktop, mobile, tablet).
- Uses machine learning models (pre-trained predictors) to estimate the ideal CPC for desktop traffic.
- Applies device-specific adjustments for tablet and mobile CPCs based on CVR differences.
- Converts CPC values into local currency using exchange rates to match regional markets.
2. CPC Calculation for Spend Target
If the advertiserās goal is to spend a specific budget over a set period, the model:- Ensures the spend target is valid (minimum $10, default $100).
- Distributes the budget over the campaign duration to determine a daily spend target.
- Retrieves past campaign data (CTR, conversion rates, competitive CPCs) based on country and category.
- Applies CTR discounts by platform (desktop, mobile, tablet) to adjust expected engagement.
- Uses machine learning models to estimate an initial CPC that meets the daily spend goal.
- Checks against competitive RPM (Revenue Per 1000 Impressions) benchmarks, ensuring CPC is competitive but not excessive.
- Applies pacing adjustments based on spending urgency (e.g., spend ASAP vs. automatic pacing).
Some words on Actual Implementation
Like the screenshot above, the overall architecture application of CPC calculator goes like this: After Advertiser set up initial parameters under each scenario ā API call will pull relevant datasets ā for `Bed_Blanet.py` to conduct the calculation (basical math + regression model)* ā Output optimal values of CPC *In real life, we need monitoring campaigns with CPC value output from our suggestion and tune our math + regression model, as well as when Rec Algo each time have major change.An Architecture Diagram Attached here

If you ask me to redo this application now, I might still use python to set up flask RESTful API and backend pipeline and modeling but with next.js front-end
Final Thoughts
People sometimes will ask, since you can calculate, why not just auto-pilot for advertisers right? We thought about it, one our calculation wasnāt that smart! And we trust advertisers who understand their content best and it is their budgets, they should have the control on how to spent their money. Second, if this becomes an automatic algo in a massive scale, basically, we are have two algos (Rec Algo and CPC Algo) competing each other, which we found difficulties to test this idea with meaningful size of samples and right metrology till the time this blog is being written.But, I think overall, this Bed and Blanket way of looking at whatās role of an ads mediation platform is interesting and meaningful!LICENSE: CC BY-SA 4.0š