In September 2007, 75 students walked into a classroom at Stanford. Ten weeks later, they had collectively amassed 16 million users, $1 million dollars in advertising revenue, and a formula that would captivate a generation.

The class—colloquially known as “The Facebook Class”—and its instructor, BJ Fogg, became Silicon Valley legends. Graduates went on to work and design products at Uber, Facebook, and Google. Some even started companies with their classmates. But a decade later, some of the class’ teachings are in the crosshairs of our society-wide conversation about phone addiction.

Fogg’s research group, the Persuasive Technology Lab, looks at how technology can persuade users to take certain actions. Early experiments centered around questions like, “How can you get people to stop smoking using SMS?” But when Facebook, then a three-year-old startup, opened its platform to third-party developers, Fogg saw a perfect opportunity to test some of his theories in the wild.

After a few lectures on the basics of behavioral psychology, students began building Facebook apps of their own. They used psychological tools like reciprocity and suggestion to engineer apps that could, for example, send your friends a virtual hug or get your friends to join an online game of dodgeball. At the time, Facebook had just begun promoting third-party apps in its news feed. The iPhone launched in the summer of 2007; the App Store would follow the year later. Fogg’s teachings became a playbook on how to make apps stick just as apps were becoming a thing.

“Within the first month, there were already millions of people using these apps,” says Dan Greenberg, a teaching assistant for the class who later went on to found the ad-tech platform Sharethrough with some of his classmates. After some students decided to monetize their apps with banner ads, apps like Greenberg’s began bringing in as much as $100,000 a month in ad sales. Fogg had a secret sauce, and it was the ideal time to serve it.

In Silicon Valley, Fogg’s Behavioral Model answers one of product designers’ most enduring questions: How do you keep users coming back?

A decade ago, Fogg’s lab was a toll both for entrepreneurs and product designers on their way to Facebook and Google. Nir Eyal, the bestselling author of the book, Hooked, sat in lectures next to Ed Baker, who would later become the Head of Growth at both Facebook and Uber. Kevin Systrom and Mike Krieger, the founders of Instagram, worked on projects alongside Tristan Harris, the former Google Design Ethicist who now leads the Time Well Spent movement. Together, in Fogg’s lab, they studied and developed the techniques to make our apps and gadgets addictive.