As his campaign swung through the western states in late March, Democratic presidential hopeful Bernie Sanders found himself stuck in California after bad weather prevented him from travelling on to Wyoming as planned. Rather than kick his heels, however, the Vermont Senator and his team decided to throw together a last-minute rally in Los Angeles.

Less than 24 hours later, an overflow line of around 1,000 supporters stretched all the way down the block outside the packed Wiltern Theatre (capacity: 1,850). They, and those lucky enough to get in and hear Sanders’s stirring stump speech, had been drawn to the event at such short notice via email blasts, texts, Facebook and other social media.

The Wiltern is one of LA’s premier music venues, and the event had the feel of a secret rock show put on by a stadium band for its most committed fans – although Scott Goodstein, CEO of Revolution Messaging, the digital agency that runs Sanders’s social media operation, resists the comparison. “We definitely didn’t want it to be secret,” he says.

This week, the Sanders campaign announced hundreds of lay-offs, apparently acknowledging that Hillary Clinton is now the presumptive Democratic nominee. But unlike Clinton, who was always expected to be a prohibitive favourite, Sanders has vastly overachieved. And his progressive message has been amplified – turned up to 11, you might say – by social media.

As he repeatedly points out, he began the race some 60 points behind the front-runner in national polls. Nowadays, they’re almost neck-and-neck. With small, online contributions, he has made more in campaign donations than Clinton (though her overall fundraising total is greater, thanks to support from the Super PACs that Sanders eschews).

His rallies have been far better attended than Clinton’s. A February survey by Cision found his supporters’ signature hashtag, #FeelTheBern, was used 75,000 times per day, more than twice as much as Ted Cruz’s #CruzCrew at 29,850, Clinton’s #ImWithHer at 27,500 or Donald Trump’s #MakeAmericaGreatAgain at 25,000.

That social media success has been harnessed by Goodstein’s firm, which is responsible for all the Sanders campaign’s digital activities, from email fundraising to shareable infographics. Yet the CEO declines to take credit for the attendance at the Wiltern event. “What did it was the energy and excitement people have for seeing an authentic politician,” he says.

Collectives of Sanders supporters were able to get together online and create buzz that persisted, even in the absence of traditional media coverage <p> </p>

Even if he loses, Sanders has built a progressive movement with the potential to push the political conversation to the left under a Clinton or Trump presidency. “I don’t think it could have happened without social media,” says David Auerbach, a fellow at the New America Foundation and Slate tech columnist, who has studied the effect of social media on politics.

“Collectives of like-minded individuals likely to be Sanders supporters were able to get together online and create buzz that persisted and was self-maintaining even in the absence of traditional media coverage. That’s integral to the Sanders campaign getting so much further than any other similar, anti-establishment campaign.”

Revolution is a boutique, 60-employee agency dedicated to progressive causes, with a pedigree that goes back at least to 2008, when Goodstein oversaw social media for the Obama campaign. Now 42, he began his national political career by co-founding Rock Against Bush, a project mobilising rock musicians to campaign against President George W Bush in 2004.

The Washington DC-based firm got its name shortly after Obama was elected; the fact that Sanders is calling for “political revolution” is just a happy coincidence. It has worked with the Democratic National Committee and with the State Department during Clinton’s tenure there. But Sanders’s presidential bid proved to be a “natural fit,” Goodstein says.

In 2012, the Mitt Romney team had 22 people approving each tweet, which kills the entire medium <p> </p>

“There are five board members and we all voted to do the Sanders campaign. And when we’re all in, we’re all in. We wanted to be part of the campaign’s DNA, and we went knee-deep very quickly. In order for a firm to do that there has to be more than an agency commitment. It has to be a family-type commitment.”

Sanders may be a cranky 74-year-old, but he has long understood the power of the Internet. Before he ran for President, his office had the largest social media presence of any US Senator, Goodstein says. “He already had a much better understanding of social media than a lot of folks on Capitol Hill.”

When Revolution suggested to Sanders that he live-tweet the Republican debates, he did so, delivering his acerbic take on the televised proceedings to his two million Twitter followers.

“In 2012, the Mitt Romney team had 22 people approving each tweet, which kills the entire medium,” Goodstein says. “With Senator Sanders, it’s the candidate himself saying, ‘This is what I want to say, put it out now’. He understands there are rapid responses that should be put out through Twitter, far more than any other candidate I’ve worked with.”

Trump, whose social media chief is his former golf caddy, has also successfully used Twitter to get attention. But while the property mogul has the biggest social media following of all the 2016 candidates – more than 14 million across Facebook, Twitter and Instagram – it is Sanders whose 5.7 million total followers are the most engaged.

In a recent, nine-month study, social media analytics platform Captiv8 measured engagement in the candidates’ social media output by counting likes per follower. The top 10 posts from any candidate were all by Sanders. The Vermont Senator’s most enthusiastic supporters are millennials, who – no coincidence – are also the most enthusiastic of social media users.

“Senator Sanders is putting out paragraphs of policy on Facebook that people want to share with their friends, talk about and engage in that policy conversation,” Goodstein says. “We’re putting out videos on income inequality that get millions of views. You wouldn’t expect the average American voter to sit and watch a six-minute video about income inequality.”

The engagement goes both ways. The #FeelTheBern hashtag, for instance, was created by Sanders volunteers and later taken up by the campaign, which turned it into t-shirts and pin-badges. “That’s a great example of us saying, ‘We hear you, social media, and we want you to become a bigger part of the campaign.’”

Not all online activity perpetrated by Sanders supporters has been positive. In recent weeks, several of the Democratic party’s so-called “super-delegates” who plan to vote for Clinton have been subjected to angry emails and Facebook abuse. According to Reuters, at least one super-delegate saw the Yelp page for his business hijacked and swamped with one-star reviews.

Journalists writing about the Democratic race have grown accustomed to the vitriolic, and in some cases delusional, comments that follows any article daring to point out the size of Clinton’s delegate lead. The Sanders campaign says it does not condone such harassment.

The 2008 Obama campaign proved the power of technology to rally support around a candidate, but the administration has been criticised in the years since for having failed to sustain that online movement. At the time, Twitter was in its infancy, Facebook restricted its groups’ memberships to 5,000 people, and MySpace was still considered a thing.

Obama may have made a political calculation that, as President, he did not want online partisans to fight his battles for him. In defeat, Sanders should have no such compunction. His online movement may not get him elected, but that gives him all the more reason to keep his supporters engaged beyond the election.

“It remains to be seen whether the Sanders message continues in a form organised by Sanders, or grows out of that movement,” Auerbach says. “But what will happen to all the Sanders Facebook groups? Do they rebrand themselves and keep going? A campaign and a candidate is a simpler thing to support than an abstract issue.”

The Sanders campaign will be left with swathes of data and millions of energetic supporters. Many are young people, prepared to go on propagating the progressive message. They have demonstrated their capacity to fund-raise without Wall Street, and to inspire passion over issues such as income inequality, the minimum wage and campaign finance reform.