It’s not every day that a former work colleague gets retweeted by the president of the United States.

Last Friday, Rob Goldman, a vice president inside Facebook’s Ads team, rather ill-advisedly published a series of tweets that seemed to confirm the Trump administration’s allegations regarding the recent indictments of 13 Russian nationals by Special Counsel Robert Mueller. To wit, the tweets said that the online advertising campaign led by the shadowy Internet Research Agency was meant to divide the American people, not influence the 2016 election.

Antonio García Martínez (@antoniogm) is an Ideas contributor for WIRED. Before turning to writing, he dropped out of a doctoral program in physics to work on Goldman Sachs’ credit trading desk, then joined the Silicon Valley startup world, where he founded his own startup (acquired by Twitter in 2011), and finally joined Facebook’s early monetization team, where he headed its targeting efforts. His 2016 memoir, Chaos Monkeys, was a New York Times best seller and NPR Best Book of the Year, and his writing has appeared in Vanity Fair, The Guardian, and The Washington Post. He splits his time between a sailboat on the SF Bay and a yurt in Washington’s San Juan Islands.

You’re probably skeptical of Rob’s claim, and I don’t blame you. The world looks very different to people outside the belly of Facebook’s monetization beast. But when you’re on the inside, like Rob is and like I was, and you have access to the revenue dashboards detailing every ring of the cash register, your worldview tends to follow what advertising data can and cannot tell you.

From this worldview, it's still not clear how much influence the IRA had with its Facebook ads (which, as others have pointed out, is just one small part of the huge propaganda campaign that Mueller is currently investigating). But no matter how you look at them, Russia’s Facebook ads were almost certainly less consequential than the Trump campaign’s mastery of two critical parts of the Facebook advertising infrastructure: The ads auction, and a benign-sounding but actually Orwellian product called Custom Audiences (and its diabolical little brother, Lookalike Audiences). Both of which sound incredibly dull, until you realize that the fate of our 242-year-old experiment in democracy once depended on them, and surely will again.

Like many things at Facebook, the ads auction is a version of something Google built first. As on Google, Facebook has a piece of ad real estate that it’s auctioning off, and potential advertisers submit a piece of ad creative, a targeting spec for their ideal user, and a bid for what they’re willing to pay to obtain a desired response (such as a click, a like, or a comment). Rather than simply reward that ad position to the highest bidder, though, Facebook uses a complex model that considers both the dollar value of each bid as well as how good a piece of clickbait (or view-bait, or comment-bait) the corresponding ad is. If Facebook’s model thinks your ad is 10 times more likely to engage a user than another company’s ad, then your effective bid at auction is considered 10 times higher than a company willing to pay the same dollar amount.

A canny marketer with really engaging (or outraging) content can goose their effective purchasing power at the ads auction, piggybacking on Facebook’s estimation of their clickbaitiness to win many more auctions (for the same or less money) than an unengaging competitor. That’s why, if you’ve noticed a News Feed ad that’s pulling out all the stops (via provocative stock photography or other gimcrackery) to get you to click on it, it’s partly because the advertiser is aiming to pump up their engagement levels and increase their exposure, all without paying any more money.

During the run-up to the election, the Trump and Clinton campaigns bid ruthlessly for the same online real estate in front of the same swing-state voters. But because Trump used provocative content to stoke social media buzz, and he was better able to drive likes, comments, and shares than Clinton, his bids received a boost from Facebook’s click model, effectively winning him more media for less money. In essence, Clinton was paying Manhattan prices for the square footage on your smartphone’s screen, while Trump was paying Detroit prices. Facebook users in swing states who felt Trump had taken over their news feeds may not have been hallucinating.

(Speaking of Manhattan vs. Detroit prices, there are some (very nonmetaphorical) differences in media costs across the country that also impacted Trump’s ability to reach voters. Broadly, advertising costs in rural, out-of-the-way areas are considerably less than in hotly contested, dense urban areas. As each campaign tried to mobilize its base, largely rural Trump voters were probably cheaper to reach than Clinton’s urban voters. Consider Germantown, Pa. (a Philly suburb Clinton won by a landslide) vs. Belmont County, Ohio (a rural county Trump comfortably won). Actual media costs are closely guarded secrets, but Facebook’s own advertiser tools can give us some ballpark estimates. For zip code 43950 (covering the county seat of St. Clairsville, Ohio), Facebook estimates an advertiser can show an ad to about 83 people per dollar. For zip code 19144 in the Philly suburbs, that number sinks to 50 people an ad for every dollar of ad spend. Averaged over lots of time and space, the impacts on media budgets can be sizable. Anyway …)

The Like button is our new ballot box, and democracy has been transformed into an algorithmic popularity contest.

The above auction analysis is even more true for News Feed, which is only based on engagement, with every user mired in a self-reinforcing loop of engagement, followed by optimized content, followed by more revealing engagement, then more content, ad infinitum. The candidate who can trigger that feedback loop ultimately wins. The Like button is our new ballot box, and democracy has been transformed into an algorithmic popularity contest.

But how to trigger the loop? For that, we need the machinery of targeting. (Full disclosure: I was the original product manager for Custom Audiences, and along with a team of other product managers and engineers, I launched the first versions of Facebook precision targeting in the summer of 2012, in those heady and desperate days of the IPO and sudden investor expectation.)