Inside the ad, a camera captured their facial expressions and fed them through an algorithm, reading emotional reactions like happiness, surprise, anger, disgust, fear and sadness.

With all the unwitting feedback, the campaign could then tweak the message — the images, sounds or words — to come up with a version that voters might like better.

All over the world, political campaigns are seeking voter data and insights that will propel them to victory. Now, in an increasing number of places, that includes the contentious field known as neuromarketing — or in this case, neuropolitics.

Technologies like facial coding, biofeedback and brain imaging have long been used by companies in the hope of pushing the boundaries of marketing and product development. But their use by political parties and governments is a growing phenomenon, evoking futuristic scenes from the movie “Minority Report,” in which eerily well-informed billboards scan commuters’ eyes and call out to them by name.

The practice has come under attack, especially by academics who accuse neuromarketers of selling junk science.

But the skepticism has not dissuaded political parties in many parts of the world. According to campaign records, the campaigns of presidents and prime ministers on at least three continents have hired science consultants to scan voters’ brains, bodies and faces, all with the aim of heightening their emotional resonance with the electorate.

In Mexico, President Enrique Peña Nieto’s campaign and his party, the Institutional Revolutionary Party, or PRI, employed tools to measure voters’ brain waves, skin arousal, heart rates and facial expressions during the 2012 presidential campaign. More recently, the party has been using facial coding to help pick its best candidates, one consultant says. Some officials even speak openly about their embrace of neuropolitical techniques, and not just for campaigning, but for governing as well.

“In my government, we have utilized a variety of research tools and opinion studies to evaluate the efficacy of our governmental programs, communications and messages,” said Francisco Olvera Ruiz, the governor of the Mexican state of Hidalgo and a governing party member. “Neuroscience research,” he added, is “especially valuable because it has allowed us to discover with more precision and objectivity what people think, perceive and feel.”

In Poland, Prime Minister Ewa Kopacz and her party, Civic Platform, worked closely with a neuromarketing firm ahead of parliamentary elections last month (they lost), and in Colombia, President Juan Manuel Santos’s re-election team in 2014 tapped into the same neuropolitical consultancy advising Mexico’s governing party (he won).

In Turkey, Prime Minister Ahmet Davutoglu and his Justice and Development Party hired a Turkish neuromarketing company for the June 2015 election, according to the firm’s co-founder and chief executive. Using a mix of techniques — like tracking the brain waves, eyes, faces, skin and heart rates of volunteers in its laboratory in Istanbul — the company said that it warned that Mr. Davutoglu was not emotionally engaging voters in his speeches. The party had a major setback in the June vote, but then won in elections this month.

Neuromarketing consultants say they are conducting research like this in more than a dozen countries, including Argentina, Brazil, Costa Rica, El Salvador, Russia, Spain and, to a much lesser extent, the United States.

One neuromarketing firm says it has worked for a Hillary Rodham Clinton presidential campaign committee to help it improve its targeting and messages. When contacted about it, Joel Benenson, the Clinton campaign’s chief strategist, declined to discuss the matter, saying that he would not talk about “what methodologies we use or don’t use.”

John Weaver, who was part of several Republican presidential campaigns, including John McCain’s, and is now the chief strategist for John Kasich’s presidential bid, said that he had used neuroscientific tools in the past, but that the field’s adoption in the United States was “very limited.”

Neuroconsultants and some of their political patrons argue that the benefits are obvious: Focus groups and surveys can be unreliable because voters often do not know, cannot articulate or are reluctant to say how they really feel about a candidate.

Brain waves, facial expressions and neurobiology, by contrast, betray a voter’s feelings and opinions, making them a better predictor of behavior at the polls, proponents argue.

But some neuroscientists have been sharply critical of the field for overpromising results. They argue that just because a candidate or a speech prompts activity in a particular region of the brain, that does not mean researchers can be sure of what voters are thinking.

“For the most part, I think that companies selling neuroscience-based market research tools are taking advantage of people’s natural tendency to think that measurements of the brain are somehow more ‘real’ than measurements of behavior,” said Russell Poldrack, a psychology professor at Stanford University.

Many political parties and campaigns are loath to talk about their forays into neuropolitics, with many disavowing them or saying they did not believe the research was widely used. Even if the techniques work, the potential fallout from being connected to such methods could be significant.

“Imagine headlines in The Daily Mail or The Sun about brainwashing, lab rats and manipulation,” read a recent article about the techniques posted by Mediatel, which focuses on the British news media.

The top three market research companies in the world — Nielsen, Kantar and Ipsos — do conduct neuromarketing research for big brand names and are upfront about it. But all three said they had a policy of not doing this type of research for political clients.

Some neuroconsultants are open about what they do. Dr. Jaime Romano Micha, a Mexican neurophysiologist, has spent decades trying to understand the human brain and helping children with neurological and psychological disorders. A clinic he founded says it has treated more than 30,000 patients.

Dr. Romano Micha’s work eventually spread to consumer marketing, and then, more recently, to politics after Mexican politicians approached him.

Dr. Romano Micha said Mexico’s governing party hired his firm, Neuropolitika, in the run-up to the 2012 national election to assess competing candidates and opportunities for Mr. Peña Nieto to connect with Mexican citizens.

Dan Hill, a facial coder in the United States, said the campaign also commissioned him to analyze expressions on the faces of Mexican voters and candidates during presidential debates.

Both said they told the Peña Nieto team to take the leftist candidate more seriously than the conservative contender. Mr. Peña Nieto ended up winning the national vote by six percentage points over the leftist candidate. The conservative candidate finished third.

Then in state and local elections this June, Dr. Romano Micha said he warned the PRI about widespread voter frustrations, though the phenomenon probably would not have required a scientist to point out.

“We warned well in advance of the high rejection level towards the three main Mexican parties,” he said. “Through our neuronal studies, we saw how voter sympathy levels, approach/withdraw and voting intention variables were shifting.”

Since 2008, the neuromarketing field in the United States has consolidated, leaving much of the work in the hands of a few large research firms. In Latin America and Europe, it is easier for smaller neuromarketing start-ups and experimentation to crack the market, reflected in the growth of neuromarketing companies and activity outside the United States over the last several years.

Neuromarketing, often rebranded as “consumer neuroscience” in response to the criticisms of the field, has quietly evolved in many parts of the world. Most neuroresearch vendors now take great pains to emphasize their adherence to scientific and industry standards, transparency and ethics.

Today, neuropolitical projects are often an international enterprise. A Spanish research firm, Emotion Research Lab, says it is conducting automated facial coding for Mexican candidates at all levels of government. A Polish company, Neurohm, says it has advised American presidential campaigns over several election cycles. A political strategist from Brazil, Paulo Moura, says he has recently applied neuropolitical techniques for senior government officials in Russia.

In Mexico, Emotion Research Lab used the cameras embedded in its digital sign to analyze onlookers’ facial reactions so the campaign could rapidly adjust the message.

It may sound like dystopian fiction, but Maria Pocovi, the firm’s founder, says the company has helped the PRI vet and select five candidates according to how well their faces emote and emit.

Neuroconsultants contend that political interest in their work is growing, yet they acknowledge it is still largely considered taboo.

“Citizens don’t know what neuromarketing is,” said Kilinc Orhan Erdemir, the co-founder and chief executive of Neuro Discover, who said he worked for the governing party in Turkey’s 2015 election. “They see it as a mind manipulation technique. So politicians fear talking about it.”

Several American political consultants said neuropolitics could become more prevalent in the 2016 presidential campaign.

David Plouffe, President Obama’s former campaign manager, said the tools “would be new ground for political campaigns.”

Mr. Plouffe added: “The richness of this data compared to what is gathered today in testing ads or evaluating speeches and debates, which is the trusty old dial test and primitive qualitative methods, is hard to comprehend. It gets more to emotion, intensity and a more complex understanding of how people are reacting.”

But “the horrendous dial ratings on the bottom of televised presidential debates,” he said, referring to the real-time reactions of undecided voters shown on the television screen, “may now be replaced with the only thing worse: sweat, eye and cardiac monitoring measurements of key voter segments.”