After President Trump vowed to take credit for shutting down the government over border wall funding during a televised Oval Office meeting with Democratic leaders in December, West Wing aides sprang into overdrive to clean up the mess.

Taking ownership of a shutdown was considered verboten in Washington, and the overwhelming consensus was that the president had screwed up.

But Trump was elated with the media coverage that followed.

 “This is why I was so great on ‘the Apprentice,’ ” he told a startled Speaker Paul D. Ryan (R-Wis.) during a phone call the next morning, crowing that the ratings of the meeting were “great.”

Ryan said he did not know such government meetings scored ratings — or that they were released within 12 hours, according to aides familiar with the call who spoke on the condition of anonymity to describe the private conversation. Trump told Ryan that everyone watched and that Trump was dominating the TV — and that made the meeting a success.

After more than two years in office, Trump continues to view his presidency through TV ratings and news coverage, while assessing the worthiness of his allies by how they perform during cable news hits.

Since Attorney General William P. Barr said last weekend that the special counsel’s investigation into Russian interference in the 2016 election did not establish a conspiracy between the president’s campaign and Moscow, Trump has seemed most interested in how the findings are playing on TV.

He has reveled in the falling ratings of networks he claims unfairly covered the Russia investigation while celebrating his allies in conservative media who joined him in calling special counsel Robert S. Mueller III’s probe a “hoax” all along. Trump has checked ratings daily, according to his aides, and has bragged to senators and others that Fox News is doing better than competitors such as MSNBC and CNN.

“Wow, ratings for “Morning Joe,” which were really bad in the first place, just “tanked” with the release of the Mueller Report. Likewise, other shows on MSNBC and CNN have gone down by as much as 50%. Just shows, Fake News never wins!” he tweeted Thursday.

Trump’s numbers are exaggerated, but ratings for several of the Fox News shows supportive of the president went up in the days following the release of Barr’s summary of Mueller’s report, while ratings for their competitors on MSNBC and CNN went down.

Lawmakers have learned that when they go on TV, oftentimes the president has been watching, and since the release of Barr’s summary of Mueller’s report, he has been watching closely.

When he attended the weekly Senate Republican lunch on Capitol Hill on Tuesday, Trump opened his remarks by telling senators that he appreciated them defending him on TV, before he called the probe “two years of bullshit.”

At the private lunch, Trump immediately turned to Sen. John Neely Kennedy (R-La.) and commended him for his television appearances earlier that day, according to attendees.

“He just said, ‘I saw you on TV and you did a good job,’ ” recalled Kennedy.

The president has spoken more to senators about what they argued on TV defending him during the special counsel’s probe than the actual conclusions of the case, according to people familiar with the conversations. And Trump has repeatedly told aides how the television coverage has changed, remarking favorably that the chyrons are not always about the Mueller case anymore.

Republican lawmakers have grown accustomed to Trump’s predilection to obsess over TV and the coverage of him — and have adapted. 

While negotiating with Democrats in December on a potential deal to reopen the government, Sen. Lindsey O. Graham (R-S.C.) said Trump did not yet know the details of his new immigration idea. He planned to first pitch the idea to Laura Ingraham — whose show he would go on later that week — and Sean Hannity and Lou Dobbs, among other TV hosts.

If they were on board, Graham said, Trump would be far more likely to support such a deal. If they weren’t, Trump would be unlikely to support it. The deal never went anywhere. A spokesman for Graham did not respond to a request for comment.

Sen. Rand Paul (R-Ky.) had aggressively tried to pitch White House staff on association health-care plans without luck in late 2017. So instead he went on Fox News on a Friday night and made his pitch. Soon, Trump tried to call him, intrigued by the idea and endorsed the proposal after meeting with the senator, according to White House officials who spoke on the condition of anonymity to describe the conversations. 

Marc Short, the president’s former congressional liaison, and now the vice president’s chief of staff, brought Trump a long list of reasons — including more military spending — to sign a spending bill last year. But Trump had watched some of his top allies torch the bill on TV for not having enough money for his border wall and complained that if the bill was so good, why weren’t lawmakers saying that on news programs?

Short then told Hill leadership offices that if they wanted Trump to sign the bill, they should get on TV and make the case. 

Reps. Mark Meadows (R-N.C.) and Jim Jordan (R-Ohio), leaders of the conservative House Freedom Caucus, are frequently called by the president — partially because they are often on TV defending him. “My warriors,” he calls the two men who have been influential in shaping administration policies. In a recent meeting with Republican lawmakers, Trump referred to Rep. Devin Nunes (R-Calif.) as a “patriot” and a “great American” for his fierce defenses of the president on Fox News, according to people who heard the remark. 

One reason Ryan struggled with Trump was because the president would often call him early in the morning to talk about what was on “Fox and Friends,” and Ryan was not usually watching or versed on the particulars of the show.

On a recent Friday, Sen. John Barrasso (R-Wyo.) was on Fox News, defending his vote to uphold Trump’s emergency declaration at the border. Not long after his cable news appearance, Barrasso had a voice mail from Trump, asking him to return his call. Several lawmakers said they have received calls before they could even get off set. 

“He thanked me for the vote,” recalled Barrasso. “It’s an important vote [about] border security, the crisis at the border, and we’d been at the White House the day before. So he called about that.”

That instance wasn’t a unique circumstance. Back in December, when Barrasso was on CBS’s “Face the Nation,” Trump called him up not long after, telling the senator that he was “making a good face for the party, making the case for the country and the importance of what we are doing with jobs and the economy, national security, border security.” 

Asked whether Trump offers critiques on his television performance, Barrasso laughed and responded: “No, not to me. Maybe to others.” 

But a number of members know it’s the best way to get a call from the president. 

“I think other members, when they’re on, they hear from him as well,” Barrasso said.