Advertising on the internet has never been easier. Data and automation increasingly allow companies large and small to reach millions of people every month, and to tailor ads to specific groups based on their browsing habits or demographics.

Now, however, the marketing industry is facing a moral quandary in the face of a national debate over the role that fake news played in the presidential election and the realization that many websites that promote false and misleading stories are motivated by the money they can make from online advertising.

In the zeal to follow consumers wherever they may roam on the internet, advertisers now risk bankrolling sites that are toxic to society, whether by amplifying manufactured political stories or by spreading conspiracy theories virulent enough to drive a man to walk into a Washington pizzeria with a gun. That has inserted a new ethical cost into the automated advertising equation, which promises companies large, desired audiences at low prices with little need for human intervention.

“I would much rather pay a little premium as a brand and go for verified sites,” Raja Rajamannar, the chief marketing officer of MasterCard, said, noting that the company mostly advertised on sites it had evaluated and approved. “But it’s a question again of how much and where. And I think all brands are doing this soul-searching at this point in time.”