Just weeks ago, “The O’Reilly Factor” was home to at least 30 nationally broadcast commercials each night, with giant sponsors like Mercedes-Benz and Aleve. By last Tuesday, that number had dwindled to 10, mainly small-budget spots for a pain relief cream and a bedding retailer, MyPillow.com.

Days later, the Fox News star Bill O’Reilly was out — taking with him a payout of up to $25 million — a strikingly swift fall ushered in by an advertising exodus that rattled the highest reaches of the Fox empire and delivered an unsettling message to corporate America: You’re on notice.

In an era when outrage can be easily channeled online, major brands are well aware of the risk of revolts from consumers who are increasingly savvy about hitting companies where it hurts. Brands are not waiting to dissociate themselves from thorny issues that might alienate their customers, be it Mr. O’Reilly’s behavior or a North Carolina law against transgender bathrooms.

“The allegations are disturbing,” a Mercedes spokeswoman, Donna Boland, said in a blunt statement after the company pulled its “O’Reilly Factor” ads. “Given the importance of women in every aspect of our business, we don’t feel this is a good environment in which to advertise our products right now.”