As we delegate more control to artificial intelligence, both businesses as well as users are venturing into uncertain territory. In the meantime, more and more companies — start-ups, mom-and-pop stores, major corporations — are handing their dollars and their data to the social-networking giant. Facebook’s Ads Manager is user-friendly. Sales are plentiful. And if you don’t take advantage of it, your competitors will. How could you not go there?

By mid-March, a few weeks after I first followed Rosen, the Hubble team no longer had 15 Facebook and Instagram ad sets. It had 40 — all pointed at discrete audiences, each with its own handful of ads. But Rosen looked more rested, less frazzled. He explained that he and Paul Rodgers had developed something they called “Robo-Dan,” a few lines of code that checked the Ads Manager every hour, then adjusted the budget as Rosen would. He could wake up and let the ads run (although he had to fight the compulsion to check on Robo-Dan). Soon, he told me, they would upgrade to Robo-Dan 2, which would switch in new ads, taking over the nightly bedtime routine. (With 40 audiences, he told me, going through the process lasted almost as long as an entire episode of “The Late Show With Stephen Colbert.”) Finally, he said, he was getting some distance from Facebook’s everyday machinations. Someday soon, he would be able to go to bed early, he told me. Or have an evening to himself.

But by the end of June, Rosen’s stress-free life was still a dream. A new problem arose: No matter what new ads they put in an ad set, the growth rate of sales declined and the cost per acquisition went up. They began to think it was an audience problem: Had they found all the customers in those groups? With their ad sets going fallow, the Hubble team scrambled to find fresh and fertile ground. Their ideas for new audiences got quirkier, more outlandish. One week they zeroed in on people who like Sweetgreen, the salad chain. Next they went after people who had indicated that they were fans of bottled water, whoever they are. Each group fizzled after a few days — the cost per each new customer climbed higher and higher; sales dwindled. As they searched for more and more audience descriptors, they landed upon a novel idea: They began trading their Lookalike groups with other online retailers, figuring that the kind of people who buy one product from social media will probably buy others. This sort of audience sharing is becoming more common on Facebook: There is even a company, TapFwd, that pools together Lookalike groups for various brands, helping them show ads to other groups.

Cogan and Horwitz have decided that they need to reduce their dependence on Facebook advertising, for the sake of their business and their own sanity. In May, they tested their first 15-second cable-television commercials. With TV, the data is vaguer, and it takes longer to get results back. Yet even though the old medium provides them with less information than Facebook, in some ways the ignorance is bliss. “There’s fewer levers; there’s less to stress out about.” Rodgers says. “You can push the button and get on with your life.”

In August, the Hubble team finally handed over their domestic Facebook advertising work to an outside agency, Ampush, that charges them based on how many new customers sign up. Ten people at Ampush now do the job of Rosen and Robo-Dan. Still, the handoff was bittersweet. “We ran their numbers — it’s something we could beat,” Rosen says, meaning Hubble could get more customers for less money if it did the ad buying in-house. “But it would destroy our lives.”

Thanks largely to Facebook, Hubble is on track to finish its first full year in business having made $20 million in revenue. In August, Hubble raised $10 million, valuing the company at $210 million. In January, Hubble will use those funds to expand its business to Continental Europe. Its advertising strategy? Robo-Dan, with some help from Rosen. As Hubble advances into new territories, Facebook and the algorithm will be tagging along with them.