It’s no secret that businesses track consumers online and study social media to learn more about their shopping habits. But the public backlash against Sony after its response to being hacked, criticism of Target’s handling of its 2013 cyberattack and other examples of corporate embarrassment have put a spotlight on another type of analysis — measuring public sentiment about a business.

Now, contractors that traditionally performed this type of work for government intelligence agencies are offering their skills to large corporations.

BAE Systems, which spent more than $200 million acquiring analytics companies last year, is the latest example of a defense contractor branching out into commercial work as federal spending shrinks.

The company announced a social media monitoring service for businesses last week that would “detect malicious or inadvertent leaks of sensitive information and intellectual property, potential insider threats, social engineering attempts, smear campaigns, and other issues of concern.”

Corporations are increasingly looking for early warnings to manage potential disruptions, said Peder Jungck, vice president and chief technology officer for BAE’s intelligence and security sector.

One of ten dogs rescued from the streets of Sochi, Russia during the Winter Olympics at its new home in Washington. BAE Systems analysts were able to track an increase in posts about Sochi’s stray dog problem through social media monitoring. (Linda Davidson/The Washington Post)

“Companies go into crisis-management mode when something happens, but now they want to get ahead of an incident,” Jungck said.

Not everyone is excited by the prospect. The thought of government contractors offering intelligence-level expertise to corporations worries some privacy advocates.

“This is the creation of a digital blacklist,” said Jeffrey Chester, who leads the Center for Digital Democracy. “A system designed for defense use should not be unleashed on the everyday goings-on of Americans.”

Arlington-based BAE Systems, the U.S. arm of the British contractor, purchased two analytics companies last year: a North Carolina small business that provides imaging technology and analytics to the government, and a Texas intelligence firm. Some of the tools acquired through those purchases have been incorporated into the new offering, Jungck said.

The service is based on a pilot project BAE conducted during the 2014 Sochi Olympics. Special software scrutinizes what people are saying about a company on social media, Web forums, discussion boards and other corners of the Internet. Data analysts put the findings into context — separating “normal” online outrage from something more serious — to identify risks for a business, from the threat of cyberattacks to online activism.

During the Sochi experiment, the company’s McLean-based Advanced Analytics Lab monitored online chatter about the Olympics to study how people discussed security, infrastructure and other concerns related to the event. Analysts were able to track an increase in posts about Sochi’s stray-dog problem and unprepared hotels as long as 12 days before they were confirmed in reporting by traditional news media, according to Jungck. The company didn’t have a specific client but used the event to demonstrate its technology to potential customers, he said.

BAE Systems isn’t the only Washington-area contractor investing in sentiment analysis.

McLean cyber analytics firm Novetta Solutions also acquired two companies last year: Global News Intelligence, which analyzes media reports to track the spread of influence and rhetoric and SigInt Technologies, an intelligence analysis company.

Although GNI worked primarily with government clients, founder Bryan Rich said the commercial sector promised more growth.

“Large companies are starting to act like nation-states,” he said. “They need tools to be able to manage and understand what’s happening around them.”

More recently, Reston software company NCI purchased Computech, a big data analysis company, to expand out of pure defense work.

Companies interested in sentiment analysis, as the service is known, range from financial firms and retailers that want to watch for rhetoric from hackers, or big energy companies that want to monitor perception at their global locations, Jungck said.

The technology can be used to give companies a heads-up on negative publicity.

In a 2014 analysis of Fortune 500 firms, BAE Systems looked at those companies that experienced protests at their annual meetings. By studying activists’ public social media posts prior to a demonstration, BAE found that on average, people were discussing the company or making plans 12 days in advance of the event.

Facebook was “a particularly rich forum for anti-corporate dialogue,” the report said, accounting for nearly 80 percent of discussions leading up to protests.