President Trump is ramping up his formidable digital operation nearly two years before the 2020 election, doubling down on a playbook that helped pave his path to the White House.

Trump's campaign has already spent more than $3.5 million in small, targeted ads on Facebook, while an allied group has spent more than $6 million, making him the biggest U.S. political spender since Facebook began tracking ad spending in May 2018.

And just like in 2016, Trump is pairing the heavy spending with an active Twitter feed, dishing out insults and mocking his potential Democratic opponents as their long and crowded race to the nomination gets underway.

The president is already seeing dividends: Trump ended 2018 with $19 million in cash on hand, most of that from small donors.

The campaign had also raised about $130 million as of last year, the most by any sitting president at that point in the cycle, according to The Washington Post.

The heavy spending is raising alarm among some strategists who work with Democrats, who warn 2020 contenders risk falling too far behind.

Trump's campaign is "able to actually deliver consistent messaging and keep folks engaged and keep raising money and growing their list, while obviously those efforts on the Democratic side are going to be spread out over a number of candidates over the coming months," said Tara McGowan, the CEO and founder of ACRONYM, an organization that seeks to help Democrats with their digital strategies.

The president's massive spending comes as Democratic candidates are just recently ramping up their digital spending.

Among the heaviest Democratic spenders in Facebook ads is Sen. Kamala Harris's (Calif.) campaign arm, which has spent nearly $300,000, according to data from the social media platform.

She is trailed by Sen. Elizabeth Warren (D-Mass.), at around $275,000, and Sen. Cory Booker (D-N.J.), at about $200,000.

Though incumbent presidents have always had an advantage over the opposing party since they usually do not face an opponent during primaries, the scale of Trump's spending and the sophistication of his digital operations is unparalleled among sitting presidents, according to analysts.

Trump's digital operation in 2016 was so successful he appointed the man widely credited with steering it, Brad Parscale, as his campaign manager for 2020.

In an interview with PBS's Frontline documentary "The Facebook Dilemma," Parscale called Facebook a critical aspect of Trump's campaign in 2016.

He said it allowed Trump to "speak directly to camera" and use microtargeted ads to tailor messages to specific communities and demographics.

"We might write 50,000 ads that only have very, very small nuances changed about them," Parscale said.

The Trump campaign did not reply to requests from The Hill seeking comment from Parscale.

A similar strategy appeared to be in place ahead of 2020.

Facebook data showed the Donald J. Trump for President Committee spent more than $3.5 million since May 2018, spread out over 77,230 ads, or an average cost of $45 each.

Similarly, the Trump Make America Great Again Committee, run jointly with the Republican National Committee, spent $6.2 million over 91,538 ads, or an average cost of $67.

The number of ads placed far surpassed other political ad buyers, and they closely tailored their message to current events while sounding distinctively like Trump.

For example, ads currently active in the social media platform show messages urgently calling supporters to help Trump build a border wall and fight off Democrats and House Speaker Nancy Pelosi (D-Calif.).

"I cannot allow America's safety and security to be put at risk any longer. WE NEED THE WALL, and I must put AMERICA FIRST!" one of the ads reads.

"Nancy Pelosi is threatening legal action over YOUR WALL. We need YOU to make a HUGE statement to the Democrats to show you want to FINISH THE WALL!" it also says. "DONATE NOW! Tell Democrats: FINISH THE WALL."

Data from ACRONYM also showed a huge spike in ads placed by Trump during January, a period that was marked by a record-long government shutdown.

Facebook does not provide a breakdown of where the ads were posted on its site.

Trump's digital playbook is also supported by his active Twitter feed, which he has uses to attack potential Democratic opponents, including labelling Sen. Bernie Sanders (I-Vt.) as "Crazy Bernie" and calling Warren "Pocahontas," a charge many see as racially charged, over her past claims of Native American ancestry.

Trump used similar insults in 2016 to define his Republican opponents during the primary, including calling former Florida Gov. Jeb Bush "low energy" and referring to Sen. Ted Cruz (Texas) as "Lyin' Ted" and Sen. Marco Rubio (Fla.) as "Little Marco."

Basil Smikle, a Democratic strategist, said it could prove similarly effective during what is shaping up to be one of the most crowded - and longest - Democratic primaries.

"That eventual nominee is going to have to go through a multi-candidate primary ... and then the whole while as that person starts to elevate, Trump's going to use Twitter to go after them," he said.

"So that by the time we get to the general election, he has created a narrative for whoever comes to oppose him," Smikle added. "And then the question is, how does the Democrat respond to that?"

2020 Democratic contenders are showing they have absorbed the message behind Trump's success in 2016, making key hires in digital while ramping up their Facebook ad spending.

Harris, for example, who is seen as having one of the best starts among Democratic contenders, hired alumni of Sen. Tim Kaine's (Va.) Senate campaign and 2016 Democratic nominee Hillary Clinton's presidential campaign who have worked in digital strategy.

She also tapped a digital firm headed by Mike Nellis, who worked on Sanders's insurgent presidential campaign three years ago.

Some of the 2020 contenders have already shown a keen understanding of digital media, most prominently Sanders, who was widely credited for smartly leveraging the medium during his unsuccessful run for the 2016 Democratic nomination against Clinton.

Sanders also has an army of small-donor supporters, which he showed off by announcing he had raised $6 million just over a day after announcing his 2020 presidential bid.

Meanwhile, former Rep. Beto O'Rourke (D-Texas), who has said he is deciding whether to run for president in 2020, proved a keen digital campaigner last year, when he came less than three points away from defeating Cruz in the red state.

Facebook data showed O'Rourke spent more than $8 million on Facebook - an amount overtaken only by Trump - and has proven an adept fundraiser among small donors, raising more than $70 million last year.

But analysts believe Democrats will need to do more as the party braces to take out Trump in 2020, not least because he has already amassed a huge list of supporters that he can continue to target via emails or Facebook ads.

Democrats "need to stay focused on the general election and build up infrastructure and keep Democrats engaged and mobilized around the general," said ACRONYM's McGowan.

"I think that's a really important piece of this because Trump has effectively already begun his general election campaign."