Donald Trump derided the use of data and technology tools for his presidential campaign - but those techniques might well have propelled him to victory.
Trump's stealth digital campaign, thrown together hastily in the final months of the campaign, allowed the Republican billionaire to fine-tune his message and reach voters in crucial Rust Belt states that gave him an Electoral College majority.
During the primaries, Trump dismissed as "overrated" the kinds of data analytics and "micro-targeting" successfully used by President Barack Obama.
But after winning the nomination, he quietly developed a digital strategy led by a political neophyte, his son-in-law Jared Kushner, and a data company whose parent firm worked on the Brexit campaign.
In the final stages of the race, Trump relied on insights generated by Cambridge Analytica, the US unit of British behavioural marketing firm SCL, that allowed his campaign to reach voters in the key states of Pennsylvania, Michigan and Wisconsin that delivered his majority over Democrat Hillary Clinton.
"We built an algorithm that generated top cities to reach the highest concentration of persuadable voters," said Matt Oczkowski, head of the data science team for the Trump campaign at Cambridge Analytica.
"That intelligence was being updated and shared daily. This campaign had to be far more surgical because Hillary Clinton outspent this campaign by double."
The digital efforts involved "thousands of variations" of messages that were targeted based on voter profiles to platforms such as Facebook, Snapchat or Pandora radio, Oczkowski said.
Cambridge Analytica said its 4,000 different online ads for Trump were viewed 1.5 billion times by millions of Americans.
The data science team could glean information about users to deliver pitches "based on the issues they care about," Oczkowski said.
While many factors contributed to Trump's win, data analysts from both parties said a major element was determining who would turn out to vote.
"The linchpin to understanding this election was based on the ability to understand who a likely voter was," said Oczkowski.
"The main reason we were hired was to quantify the Trump effect," and to quantify "how unique this candidate was."
Tom Bonier, CEO of the consultancy TargetSmart that worked with Democratic candidates, agreed that understanding turnout was a key factor in 2016.
"If there is an Achilles heel in analytics, it is predicting turnout," Bonier said.
"The models do a great deal in predicting how people are going to vote, but have a hard time predicting who is going to vote."
Trump's digital strategist tapped by Kushner was Brad Parscale, head of a Texas-based marketing firm who was new to politics.
Parscale's lack of experience may have played to his advantage, said Chris Wilson, CEO of WPA Research, who led digital strategy for Senator Ted Cruz's presidential bid.
"There's a lot of value in going into a campaign knowing what you don't know," Wilson said.
"The Clinton team knew what it would take to motivate an Obama voter and assumed the same approach would work, and it didn't."
Effective digital targeting involves gathering data from various online and offline sources to match voters to their profiles on Facebook and other platforms.
"I can take a predictive model of a potential Trump voter that I can match to Pandora, and match it to the kind of music they listen to and target them on Snapchat based on the filters they use," Wilson said.
A report by Bloomberg/BusinessWeek said the Trump campaign used micro-targeting to deliver negative messages on Facebook - reminding them of Clinton's comments and "super predators" seen as disparaging to African-Americans - in an effort to depress turnout.
Oczkowski said negative ads were "a very small part of our strategy" and that "most of our focus was to reach our voters."
He added that the campaign did only a small amount of "psychographic" profiling because of the limited time frame it had to work in.
The company said it was able to review and update ads on a daily basis to reach undecided voters, who were divided into 12-15 subgroups for "highly-targeted" messages.
"Our cutting-edge digital capabilities allowed the campaign to reach voters more effectively than ever before, and at a fraction of the cost spent by the Democratic candidate," Cambridge Analytica CEO Alexander Nix said in a statement.
Wilson said that there is no evidence that negative ads and posts depressed turnout, and that such efforts "are more likely to do the opposite" by energising supporters.
Bonier said there appeared to be a slight drop in turnout of black voters in key states, but that it was not clear if this was due to Trump's ads or other factors.
"It's difficult to draw too many lessons from this particular campaign, this was such a unique race," Bonier said.
"We did see some new tools emerging, Snapchat was one of them, but I think agility is the lesson, the ability to adapt to the changing landscape."