Problem
An advertiser setting up an ad group wants to know how many people the targeting can reach, to plan the budget before launch. Targeting is an arbitrary mix of ages, languages, interests, keywords and uploaded user lists, and the number must update each time the advertiser changes a setting. Scanning raw traffic logs is too slow for that, and interest labels come from machine learning models, so counts shift whenever a model changes.
Example from the article: Pinterest Ads Manager shows a Potential Audience Size and refreshes it as the advertiser edits the ad group.
Solution in brief
Treat sizing as ad serving run in reverse. Instead of matching one ad request against many ad groups, match one targeting spec against many logged ad requests. Sample ad requests into a search index, count the matches for the targeting query, correct the count for list lookups, then extrapolate the daily count to the requested period and show it as a range.
Questions this case answers
- How to estimate in real time how many users match an arbitrary combination of attribute filters, using only a sample of logged traffic
- How to correct a count for the false-positive rate of a compact membership structure used to represent very large user lists
- How to show an advertiser the size of the targeted audience while they edit targeting settings?
- How to count users matching an arbitrary mix of demographics, interests and keywords in real time?
Tools and methods
- Inverted index over ad queries — one document per logged ad request, rebuilt daily
- Muse (Pinterest's internal search engine) — builds the index and returns the number of documents matching a query
- Planning service — four layers (sanitize, rewrite, forecast, retrieval) that build the query and post-process the answer
- Bloom filter per Audience list — stores the user ids of an advertiser's list compactly, with a false-positive correction on the count
Google or a one-time email code. No password.