On the 10-point election-astonishment scale, Jane Kim’s showing against Scott Wiener for state Senate in the June primary was an 11.

Virtually everyone, including Kim’s political brain trust, had her trailing by as many as 15 percentage points when she declared. But in the primary, Kim not only came within two points in the early returns, but as uncounted ballots trickle in she’s pulled even. There’s even the thought that she might pull out the win.

Over at Storefront Political Media, which is running Kim’s campaign, they’re feeling pretty good about themselves — understandably. Founder Eric Jaye, who is known in San Francisco for guiding former Mayor Gavin Newsom’s campaigns, puts it succinctly.

“It was their race to lose,” he said. “And they lost it.”

What Jaye and his staff don’t want to hear is that this was a “Berning Man” candidacy, fueled by an endorsement from presidential candidate Bernie Sanders. Or that it was all about the unconventional TV ad — which has been viewed thousands of times on YouTube — of Kim in her tae kwon do uniform, kicking a punching bag.

“The ad gets somebody’s attention,” says Storefront Senior Account Executive Julie Edwards. “But it only works if there is something behind it.”

And that’s all to come. Sanders won’t be running in November, so the Bernie factor will be diminished. And the general election will only be between Kim and Wiener, so there will be plenty of time to discuss and debate substance and issues.

But Jaye’s group does have a significant point to make. They say they are running an innovative campaign for the new electronic media world. They make the point with a simple campaign contrast.

“Scott Wiener sent out 12 pieces of mail,” Jaye said. “Jane sent out one.”

That’s because the Storefront people think spending money to fill mailboxes with voter cards is old school.

“That kind of bombardment is not as effective as it once was,” Jaye says. “You know you have a problem when the synonym for your mailer is ‘junk.’ On the technological side, I don’t think it was a contest.”

Their theory is that voters are much more likely to read and respond to an endorsement by a friend on Facebook than a mailer. The challenge is identifying the people who are not only likely to support a candidate like Kim, but are willing to tell others about her.

“We want someone who cares and shares,” says Kate Maeder, who developed the Storefront data analog to seek out and target those voters. “We are finding people who want to engage in politics.”

Using available data sites like voter records and personal demographics, Maeder has created a program that targets what Storefront calls “influencers.” It isn’t just that they vote, but that they’ve done something to indicate that they are interested in engaging in political conversations. Then they use that information to target likely supporters.

Here’s an example. As the November election approaches, if you sign on to SFGate.com — and please do — and you see a Jane Kim ad, there’s a reason. You’ve been targeted. Internet advertising has become so specific that certain ads can be presented only to likely customers. A Republican who supports Donald Trump wouldn’t see the Kim ad. But a Sanders supporter who voted in the past three elections probably would.

“Rather than contacting 10 people in the hope of finding the one out of 10 who is interested,” Jaye said, “if you can find that one, and target him, you are 10 times more effective. I think we are the only ones doing it in this way.”

So everyone should give it a try? A word of caution, gathering and interpreting the data together isn’t easy.

“Tools like this are years in the making,” Jaye said. “The two others that did it before Kate left in tears.”

However, it will be interesting to see how the November election plays out. It’s a presidential year, so the turnout should be huge. Both Wiener’s and Kim’s camps insist that a larger voter pool helps them. And after a primary race with very few negative ads, you can expect Wiener’s people to go into attack mode.

“They are going to run a highly negative campaign,” Jaye said. “They’re not even making a secret of it.”

Kim will surely be called upon to defend positions on the Board of Supervisors, like a vote to reinstate the job of Sheriff Ross Mirkarimi, who was suspended after charges of domestic abuse. She also voted against Wiener’s bill to make it illegal to stroll the streets of San Francisco naked.

Jaye is unconcerned.

“We’re braced for the oncoming negative campaign,” he said.

Besides, he knows that if Kim pulls this off, it will be historic.

“We were talking about the last time a progressive won a citywide election,” Jaye said. “I think it was Art Agnos (for mayor).”

That was in 1987, nearly 30 years ago.

C.W. Nevius is a San Francisco Chronicle columnist. His columns appear Tuesday, Thursday and Saturday. Email: cwnevius@sfchronicle.com Twitter: cwnevius