In celebration of New York Magazine’s 50th anniversary, this series, which will continue through October 2018, tells the stories behind key moments that shaped the city’s culture.

It is now exceedingly normal to get stuff delivered from the internet, but in 1999, it seemed weird — especially when the person receiving the packages was someone like Jonah Goodhart, a junior at Cornell who was on financial aid, yet received between five and ten packages a day. When his roommate tactfully asked what was going on, Goodhart explained that he had been taking advantage of the copious promotions for websites like Buy.com, Drugstore.com, and Barnesandnoble.com, sometimes signing up multiple times for a coupon. “Everything is free on the internet,” Goodhart recalls saying. (Or, at least, heavily discounted.) His roommate’s next question was, “Can you send me that list of websites?”

That was the start of Colonize, the company Jonah Goodhart and his brother Noah founded during the dot-com frenzy. Jonah’s list of internet deals turned into an irrationally profitable newsletter, as companies like Barnes & Noble paid the brothers commissions for referring customers. Not necessarily paying customers, mind you. Companies wanted to show growth, so they didn’t try very hard to stop people from signing up, even multiple times with bogus email addresses, just to get freebies. “There was something that clicked with us, which was, These guys are paying us to give away their stuff,” Jonah Goodhart says. “Which seemed crazy, and turned out to be crazy.”

But for the moment, it was a gold mine. Hundreds of dollars a week, then thousands. For two kids used to working minimum wage, it was intoxicating. “We thought, We need to figure out how we get more people into our database,” Jonah recalls. “We need to do advertising.”

The Goodharts started buying ad space in other email newsletters. Anything they spent on advertising quickly converted into new subscribers who quickly converted into commissions from the likes of Barnes & Noble. “We became addicted to this concept of being able to run ads and generate revenue virtually instantaneously,” Jonah says. They couldn’t buy ad space fast enough, literally.

If it were 2018, the Goodharts could easily have purchased ads at the prices they wanted on an ad exchange — a democratized platform that gives publishers and advertisers of all sizes unprecedented access to a massive marketplace, where there are buyers and sellers at every price point and deals can be done in milliseconds. But 20 years ago, ad exchanges didn’t exist. The bulk of advertising on the web was banner ads, and those were being sold over lunches and dinners in New York City, at prices far above what the Goodharts wanted to pay. For the Goodharts to expand their business, they’d need to do more than find a guy who’d sell them expensive banner ads. They’d need to find a guy who’d goose ad servers, work against his own company, and hire a CTO who would invent a whole new technology for them, a technology that would change the way the advertising business works — and also open a can of still-wriggling worms regarding personal data, user privacy, malware, fraudsters, and commercial surveillance.

They’d need a former personal trainer named Mike Walrath.

The first banner ads appeared on Wired’s website, HotWired.com, on October 27, 1994, featuring brands like AT&T, MCI, Club Med, 1-800-Collect, and Zima. Many advertisers were confused by the web, worried about legal implications of advertising there, and suspicious of who these web-crawling users were. The ad agency, Messner Vetere Berger McNamee Schmetterer, placed some of the ads without telling its clients, figuring it would be easier to explain after the fact.

By the late ’90s, advertising on the internet was big business. Websites had banner ads, which were sold by agencies, while search engines had text ads, which were sold through automated auctions. This roughly corresponded to a bicoastal divide. “The techies on the West Coast decided, ‘Let’s charge the advertiser when people click on the ad,’” said Michael Smith, SVP of revenue, platforms, and operations at Hearst Magazines Digital Media and author of Targeted: How Technology Is Revolutionizing Advertising and the Way Companies Reach Consumers. “On the East Coast, where the mad men lived, a different model developed with typical magazine publishers or newspaper publishers who were, quote, unquote, ‘going digital.’”

The East Coast ad scene was dominated by DoubleClick, founded in 1996 in New York. DoubleClick brokered deals between publishers and advertisers and built technology for serving the ads. In 1999, it was delivering billions of ads, and hiring anyone who could type.

Mike Walrath was working as a personal trainer at New York Sports Club when he got recruited. He had done a stint making cold calls on Wall Street, but he knew nothing about internet advertising. All the big agency and brand accounts were spoken for, so he focused on finding new kinds of clients: direct-response advertisers, or “performance marketers.” These were advertisers like the Goodharts, who wanted customers to do something, like click or make a purchase or take a survey.

These advertisers were high-maintenance. While most of the salespeople at DoubleClick could close one deal and start working on the next one, Walrath would be crunching spreadsheets, tinkering with his clients’ ads as the data rolled in. Imagine this: Drugstore.com buys an ad for razors and blasts it out to 20 different sites. One percent of the people who see the ad click through to Drugstore.com on Yahoo, but 3 percent click through on Fortune.com. Quick! Shift all the ads over to finance sites, double the budget, and let’s check in at the same time tomorrow. “For the first time, direct marketers could really track their purchases and buy it by the day or by the hour,” he says. “It turned out to be a crash course in how the digital advertising market worked.” Walrath soon became the top-selling salesman at DoubleClick.

There was another aspect to Walrath’s success: DoubleClick’s ad server, the technology side of its business. Sales reps at DoubleClick would negotiate with a client. How many impressions do you need? (That is, how many people do you want to see this ad?) In what time frame? Next to what type of content? And then they’d plug those details into the ad server, which would decide when and where to place the ads.

The amount of inventory was determined by the number of people who visited the websites, and in the early days of the internet, that was much less predictable. DoubleClick’s sales reps were told to oversell in case traffic spiked. That meant that DoubleClick’s sales reps were all in competition over the same ad spots. It was the ad server that got to decide whose ads got served first.

The cheaper ads for Walrath’s direct-response clients should have been in the “remnant” category — what the ad server would serve up when all of the better stuff has run out. But Walrath found that if he pulled the right levers, he could trick the DoubleClick ad server into prioritizing, for example, those cheap Colonize ads. He’d put in an impossible order for more ads than DoubleClick could deliver and assign it an absurdly short deadline. Colonize’s ads would then start appearing in all of the best slots on the biggest sites on the web. “There were these kinds of loopholes in the system,” Walrath says.

Walrath knew that this wasn’t good for DoubleClick, but the company was making too much money to care. “I had about 25 to 30 sales reps, but Mike Walrath was 40 percent of my revenue,” Mike’s old boss Bill Wise says. Wise admired Walrath’s ingenuity, but he knew that the glitches still had to be fixed. “Other sales people would come to me and say, ‘How are Mike’s clients all running all this money and cramping us?’” Wise remembers.

Wise put Walrath in charge of a group called DoubleClick Direct, which had two mandates: (1) develop products geared toward direct marketers like the Goodharts, and (2) get rid of the loopholes in the ad server. Walrath paired up with Matt Philips, a product manager who worked with DoubleClick’s engineers. After spending a few weeks locked in a conference room, they emerged with a white paper that had all of the answers.

Unfortunately, all of that work was being done right in the middle of the dot-com crash.

DoubleClick’s stock price plunged and it started laying people off just as quickly as it had hired them. The media division Walrath, Philips, and Wise worked for was sold to a company that rebranded as Max Worldwide — which did not have the same interest in a smarter ad server.

So Walrath quit, and started a company, Right Media, with two employees: Matt Philips and Aaron Letscher, another DoubleClick veteran. The plan: Build an ad server that would always serve the highest-paying ads to the people who were most likely to click on them, and put the rest of the industry on its knees. At the time, it seemed ludicrously ambitious. Looking back, the ad server turned out to be the boring part of Right Media’s legacy.

At the start of their relationship, before the crash, the Goodharts had been dodging Walrath, who kept trying to organize lunches and outings to Knicks games, because they were self-conscious about their youth. Eventually, an urgent problem with an ad campaign prompted Walrath to call Colonize’s office and plead to be connected to Jonah. “I’m sorry, but he’s in a final,” the receptionist said. Wait, Walrath said. He’s in school?

Once the secret was out, the Goodharts and Walrath started talking regularly. When Walrath started Right Media, they were his first call. Without hesitation, they invested $250,000 and moved their ad buys to the new company. Walrath also landed a deal with AOL, another direct advertiser that was taking advantage of the crash to pick up lots of cheap ad space. Walrath acted as a high-touch broker, buying and selling ads according to his infamous spreadsheets. As it turned out, he didn’t need the Goodharts’ investment: Right Media was soon bringing in millions in revenue a month.

Media-buying was just cover for what Right Media really wanted to do, however, which was build a smarter ad server. In the midst of an ill-fated partnership with a company called Poindexter, Walrath found an engineer named Brian O’Kelley — the first technical person to listen to Walrath’s explanation of what he wanted the ad server to do and not dismiss it as impossible. O’Kelley decided to add an auction mechanism that converted different types of ad prices into a single metric, “effective CPM.” (CPM is “cost per mille,” or the price of 1,000 impressions.) This enabled every ad slot to go to the highest bidder, the way search engines were doing it. By spring of 2004, they had a working ad server that could “predict” performance, meaning calculate the likelihood of a click, and balance that with advertiser specifications and pricing in real time. They called it Yield Manager.

The problem was convincing publishers, already committed to other platforms, to use Yield Manager to fill their ad slots. Right Media could get access to some of their inventory through the rudimentary, mostly manual trading that ad networks did with each other when they had too many ads and not enough slots, or too many empty slots and not enough ads to fill them. But Yield Manager, with all of its sophisticated decision-making, was far overpowered for dealing with other people’s leftovers.

“That’s where our ambitions got a little bigger because we realized that we were able to be really smart within our own walled garden, but our walled garden was very small,” Walrath says. The triumvirate of O’Kelley, Walrath, and COO Christine Hunsicker started to talk about what to do next. “We were just spinning in place,” Hunsicker recalls. “Mike, Brian and I had a conversation that was like, ‘OK, we can keep doing the daily grind of trying build an ad network, or we can try to do something super bold.’” All the ad networks were already trading supply and demand, but they weren’t doing it efficiently. What if they all got together on the same platform to do that trading, sort of like a stock exchange, with Yield Manager at the helm?

An Israeli ad network called Cydoor and a Michigan-based ad network called Adtegrity were willing to try it, so O’Kelley and his team scrambled to build the exchange, which they called RMX. As with the ad server, the engineers were working at speed. The code was being worked on 24 hours a day. Boris Mouzykantskii, now known as the “godfather of ad tech,” recalled how O’Kelley would work until 3 a.m. and dash off an email with instructions, and his team in Russia would work on the code until O’Kelley woke up and took over again. When they finally flipped the switch in spring of 2005, no one really knew what would happen. “This is like the most duct-taped system you’ve ever seen,” O’Kelley says. But it worked. Everyone’s yields went up at least 30 percent, instantly.

“They made more money. We made more money. The advertisers made more money. The publishers made more money. Like, it was incredible,” O’Kelley says. “Everybody made more money. And it was just a perpetual motion machine.”

With those kinds of results, it was easy for Walrath to recruit more ad networks to trade inventory on RMX. Right Media’s success meant scaling quickly, which brought unexpected challenges. One of the things Walrath didn’t anticipate was that democratizing the ad marketplace would enable bad actors to swarm the ecosystem — scammy publishers sold subpar inventory that included pop-ups, pop-unders, and fake impressions; spammers and hackers bought ads to recruit victims. Walrath assumed that if he made the system more transparent and democratic, the shady buyers and bad actors would disappear, but it was the opposite. “One of the worst days of my life was getting a civil investigative demand from the state of Washington threatening to shut the system down because Yield Manager was being used as a distribution engine for malware,” Walrath says.

But Right Media was growing nonetheless. The company secured investments from Redpoint Ventures and Yahoo, after building tools to clean up the bad actors on the exchange. And a few months in, Walrath got a courtesy call from an old friend at DoubleClick. “The conversation was, ‘You guys have done a great job. I’m just calling to let you know that we’re going to be launching a product that competes with you.’”

The idea of competing with DoubleClick was terrifying, but it was also “validating as heck,” Walrath says. “From 2003 to 2006, all we heard was that this idea of an ad exchange was impossible, it wouldn’t work. There was a point when people stopped saying the ad exchange won’t work and started saying the ad exchange is the future.” The New York Times ran a story on April 4, 2007: “DoubleClick to Set Up an Exchange for Buying and Selling Digital Ads.” Then, Philips said, “It was like musical chairs and the music stopped.”

April 14, 2007: “Google Buys DoubleClick for $3.1 Billion.”

April 30, 2007: “Yahoo to Acquire Right Media for $680 Million.”

May 18, 2007: “Microsoft Pays $6 Billion for aQuantive: Massive Ad Network Consolidation Is Occuring.”

Today, the expansive and complex online advertising ecosystem runs on ad exchanges, with the big exception being Facebook (Facebook shut down its ad exchange in 2016; its walled garden was large enough to support an isolationist economy). Exchanges mean that all of the web’s ad inventory is basically in one bucket, and any advertiser, big or small, can bid on any spot. “I felt that Right Media invented something that changed our media industry,” Smith says.

This was the business model that allowed the web to grow, since any nascent website could sell an ad slot. One less desirable consequence was that it created an insatiable appetite for personal data about customers, so advertisers could decide how much to bid for any given set of eyeballs. “While we’re waiting for that page to load, the buyer decides in a computer process: ‘I know who Mike Smith is. I got a cookie on his machine,’” Smith says. “I know he travels every other week. I have this Singapore Airlines ad. I think his attention is probably worth about two-tenths of a cent right now, that’s what I’m going to bid.’ The exchange permits them to make that decision literally in the instant that the user is waiting for the page to load.” The process typically involves thousands of companies, including ad servers, data brokers, publishers, and advertisers, and it all takes less than 100 milliseconds.

This algorithmic system, the enormous heir to Right Media and DoubleClick, is called programmatic advertising, and it will account for 67 percent of global digital display advertising spend by 2019, according to the marketing agency Zenith. The Lumascape, an infamously convoluted infographic showing the ad-tech ecosystem, swelled from 100 companies in 2010 to more than 5,000 companies in 2017, largely due to programmatic. The method is increasingly being used to sell online video ads, and there is buzz about doing it for television.

At the same time, the explosion in programmatic has triggered a backlash, as the unintended consequences of a marketplace run by robots become clear. In 2017, YouTube faced a string of scandals as advertisers discovered that their ads were running on violent and racist videos, and Procter & Gamble cut over $140 million in digital advertising due to concerns about fake impressions and “brand safety.” Major publishers are rediscovering the virtues of doing deals with a human touch, and Europe’s General Data Protection Regulation law, which heavily restricts data collection on users, is forcing the data-driven ad-tech industry to consolidate.

Right Media is not one of the survivors. Yahoo let the technology lie fallow and in 2015 finally pulled the plug on the exchange. But the company’s DNA lives on in the New York tech scene, where its veterans have gone on to invest in start-ups and start companies. O’Kelley, who fought the Yahoo acquisition and was fired before it finalized, founded AppNexus, a next-generation programmatic ad-tech services company valued at $2 billion. The Goodharts founded Moat, a company that provides digital ad tracking, in part inspired by some of the malfeasance Right Media saw on its platform, which was acquired by Oracle for a reported $850 million. Hunsicker went on to be COO of Drop.io, which was acquired by Facebook; starred on Lifetime’s Project Runway: Fashion Startup; and founded Gwynnie Bee, a subscription clothing company based in Long Island City. One exception was Matt Philips, who became a libertarian activist and moved to New Hampshire.

Walrath invested in many of New York’s biggest ad-tech companies, but he’s excused himself from the day-to-day in favor of other entrepreneurial pursuits. He and his wife co-founded a production company, Atlas Films, and he owns the hipster mecca Surf Lodge in Montauk with Jayma Cardoso — and his old friends and partners Jonah and Noah Goodhart. “I’ve gone as far away from transactional advertising as I could,” he says.