The Cambridge Analytica whistleblower Christopher Wylie revealed how the firm targeted users on Facebook with political advertising.

Donald Trump and Ted Cruz's campaigns paid over $5 million each to the firm, Wylie wrote.

Cambridge Analytica targeted users that were "more prone to impulsive anger or conspiratorial thinking than average citizens" by creating Facebook groups, sharing articles, and advertising.

Cambridge Analytica already started exploring what political topics Facebook users were interested in since before the 2016 election.

Visit Business Insider's homepage for more stories.

An excerpt from a book by the Cambridge Analytica whistleblower reveals what the firm did that swayed the 2016 elections.

Christopher Wylie, a former Cambridge Analytica employee, is known for leaking documents to journalists that showed how Cambridge Analytica harvest the data of millions of Facebook users without their consent, using it to inform targeted political advertising. The campaigns of Donald Trump and Ted Cruz paid over $5 million each to the firm, Wylie wrote.

Wylie's newest book, "Mindf*ck: Cambridge Analytica and the Plot to Break America," details more about the firm's operations.

In an excerpt published in New York Magazine, Wylie says the firm used focus groups and qualitative observation to learn what Facebook users are interested in, including term limits, "draining the swamp," guns, and building walls to keep out immigrants. Wylie says that the firm was already exploring these ideas in 2014, before Trump's campaign.

Cambridge Analytica came up with ideas for how to best sway users' opinions, testing them out by targeting different groups of people on Facebook. It also analyzed Facebook profiles for patterns to build an algorithm to predict how to best target users.

"Cambridge Analytica needed to infect only a narrow sliver of the population, and then it could watch the narrative spread," Wylie wrote.

Based on this data, Cambridge Analytica chose to target users that were "more prone to impulsive anger or conspiratorial thinking than average citizens." It used various methods, such as Facebook group posts, ads, sharing articles to provoke or even creating fake Facebook pages like "I Love My Country" to provoke these users.

"When users joined CA's fake groups, it would post videos and articles that would further provoke and inflame them," Wylie wrote. "Conversations would rage on the group page, with people commiserating about how terrible or unfair something was. CA broke down social barriers, cultivating relationships across groups. And all the while it was testing and refining messages, to achieve maximum engagement."

You can read the entire excerpt in New York Magazine here.