In response, gun safety activists are escalating their efforts. They’re investing more in ads, promoting them more aggressively and making them far more provocative and uncomfortable to view.

Guns have long been at the center of a divisive national conversation about public safety, personal freedom, partisan policymaking and corporate action. In August alone, 53 people died in mass shootings, including shoppers at a Walmart in El Paso and revelers in an entertainment district in Dayton, Ohio.

This month, Walmart said it would stop selling certain kinds of ammunition, discourage customers from openly carrying guns in its stores and encourage debate around gun reform legislation. Last week, the heads of nearly 150 companies, including Twitter and Uber, sent a letter to Senate leaders calling for stronger background checks on firearms sales and “red flag” laws.

In a blog post last month, the online firearms retailer K-Var wrote that it had been notified that NASCAR was shifting its position on guns and had demanded that ads featuring firearms be changed before they would be included in its official racing programs. The racing organization did not respond to a request for comment.

The gun industry is known for its savvy marketing strategies. It has courted women and children with firearm accessories and cartoons. The National Rifle Association, before a public breakup with its advertising firm, ran an influential online media arm called NRATV.

In the 20 days after the mass shootings in El Paso and Dayton, the N.R.A. doubled its spending on digital ads compared with the same period before the attacks, to more than $21,000 a day from $10,000, according to Pathmatics, which analyzes digital advertising data. On one day, the trade group spent more than $38,000.

But the groups opposing the gun lobby have begun to ramp up their marketing activity, too. Everytown for Gun Safety, an organization funded in part by former Mayor Michael R. Bloomberg of New York, recently pledged to spend at least $2.5 million supporting gun control policies in Virginia before the election next year.