The social-media buzz generated by Britney Spears’ “Carpool Karaoke” in the past few days illustrates how crucial digital has been to the success of CBS’ “The Late Late Show with James Corden.” Among other benefits, the digital strategy has enabled the talkshow’s host, James Corden, and executive producer Ben Winston to spin off segments as standalone shows, as they did recently with “Drop the Mic.”

After Spears’ “Carpool Karaoke” segment aired on “The Late Late Show” Thursday, Winston stayed up until 4 o’clock in the morning as he “didn’t want to wait for the digital numbers to come in; I wanted to watch them live to see where we were trending worldwide on that,” he told an audience at the Edinburgh Intl. Television Festival Friday. The video has drawn 13 million views on YouTube in three days.

His response is a reflection of the importance he and Corden attach to digital in comparison with overnight ratings. “No one high fives when we beat Seth Meyers over-night; what we do love is when we have a clip that is trending on FaceBook or Twitter,” Winston said.

Digital is central to how the show is funded, primarily through brand integrations. For example, the “Carpool Karaoke” segment with Selena Gomez included a visit to a McDonald’s drive-thru, which was the result of a deal with the fast-food outlet. “That was an integration and it was incredibly profitable for the show,” Winston said, adding that it also generated 45 million views on YouTube. “We made sure it was incredibly subtle so our viewers would not for a second think that this was a sponsored bit. James and I debated it for many hours.”

It had another benefit. As part of the deal, McDonald’s printed “’The Late Late Show with James Corden’ — On Every Night On CBS” on every McDonald’s bag, paper cup and French fries carton, and these were used in all of its U.S. outlets for six weeks.

They are now deploying similar brand integrations across other segments, such as “Take a Break,” in which Corden tries his hand at various jobs. One offer, for example, has come from an airline that wants Corden to serve as a flight attendant. As well as the YouTube hits, brands benefit from the fact that the show airs in 155 countries.

There are dangers in such integrations if the show is linked to brands that are unpopular with its young audience, and Winston said there have been offers of integrations they have turned down. “You have to be careful. We’ve got a very cool brand: Corden is on the front of Rolling Stone magazine this month,” Winston said. “I’m totally aware of the fact that we have created something really special and we are getting that [young] generation come to us looking for cool, exciting, creative content, and that’s the most precious thing. We can’t sell out.”

The show’s late-night slot – with its relatively small TV audience — allows Corden and Winston to test out ideas, and YouTube and other digital metrics give them “instant feedback.” “The overnights just tell us who managed to stay awake, they don’t tell us anything about the quality [of the content] we are making. But the YouTube hits will tell us which [segments] flew so we will find bits that we never thought were that funny but we took a risk on them.”

One example of the benefits of this is the “Drop the Mic” segment, which started out as an idea for a standalone show pitched to Winston by Jensen Karp. Normally the exec producer would have to present the idea, in which celebrities rap battle against each other, as a taster tape to demonstrate to network executives how the show would work in practice. But rather than doing that, Winston turned it into a segment for “The Late Late Show” featuring a rap battle between Corden and Anne Hathaway, which proved a hit, and this was followed by segments featuring David Schwimmer and other celebs. Winston was then able to put together a taster tape along with the online metrics proving that there was an audience for the idea.

“We’ve shown we can teach people to rap and write the lyrics, with 15-20 minutes of rehearsal time… It also had a lot of buzz, [so] then it was a much better conversation,” Winston said. “The investment we made in digital meant we could go to a network and say ‘Look here’s a show that I can prove to you works. Don’t worry about the ratings, everyone’s talking about it.’ And we sold the show in 20 minutes,” Winston said. TBS ordered it to series earlier this month with a 16-episode commitment. It launches next summer.

“It’s not lost on me how lucky we are that every night we have an hour of television to fill,” Winston said. “If we throw it at the wall and it doesn’t work, who gives a sh-t? If no one watches it tomorrow [on YouTube], we can get away with it. We can take risks.”