Image copyright PA Image caption Did data win it for Vote Leave?

The referendum campaigns were lots of things - noisy, passionate, dispiriting, vicious, inspiring, predictable, and totally unpredictable.

One side relied on the conventional wisdom, coined by Bill Clinton's campaign brain, James Carville, "It's the economy, stupid."

But as one of Vote Leave's brains has revealed at length this week, they had something else - a new and powerful way of using technology to find and mobilise their support that helped them overturn the traditional political rules.

In 2016, maybe it's the data, stupid.

More detailed

In the early days of the campaign, members of the Vote Leave team told me they hoped to find a way of mashing the mountain of data that we generate in daily life online with more normal ways of measuring political support.

Their dream was of a system that could put information from Twitter, canvassing, polls, websites, apps, into one giant IT programme that would then churn out extremely sophisticated models that would reveal the areas most likely to vote Leave, down to the street.

Image copyright Getty Images

And to create models that could test the messages they were going to use, again and again and again, in a more detailed, more effective way than had ever been done before.

Of course there were already sophisticated ways of using technology to monitor political mood and moves, and to target voters. But Vote Leave's hope was for something quite different, and much more bold.

Essentially, from day one, as Dominic Cummings, Vote Leave's director, has written: "One of our central ideas was that the campaign had to do things in the field of data that have never been done before."

'Prying eyes'

In the last few years, the amount of information that's publicly available about what voters are feeling and thinking at any moment has multiplied beyond all expectations.

If knowledge is power, developing ways of grabbing and using that information was a huge prize.

The software didn't exist, so Vote Leave decided to build it themselves. They hired physicists, data experts and digital specialists and they succeeded.

Knowing the potential of the programme, they kept it under wraps. The project was even clandestine enough to be hidden from some of the MPs involved in the campaign.

"I kept the data science team far from prying eyes," writes Cummings, instructing what he describes as the "real experts" to tell those inquiring in the office: "I'm just a junior web guy."

Over the weeks they managed to develop a programme called VICS, Voter Intention Collection System, building it from scratch, which made them able to respond to the twists and turns of the referendum in ways that no British campaign had previously achieved before, down even to the level of creating a star ratings system so that local teams on the ground knew exactly where the most fruitful door knocking session would be.

Image copyright House of Commons Image caption Dominic Cummings, seen giving evidence to MPs, said Vote Leave's use of online data was key to its success

It also made their online campaign incredibly focused, with the intelligence VICS delivered, they delivered one billion, yes, billion, targeted digital adverts, mostly through Facebook, that were tested and tailored in a "constant iterative process".

Money matters in political campaigns, but so does what you do with it.

Cummings claims: "We were the first campaign in the UK to put almost all our money into digital communications then have it partly controlled by people whose normal work was subjects like quantum information."

They were willing to think what most of the Westminster establishment believed unthinkable, and willing to do things differently, with a different set of experts, namely data specialists who are not often seen as a must-have in a political campaign.

Cummings is convinced that Vote Leave's decision to spend on physicists and mathematicians who developed VICS was "one of the reasons we won".

In what could be metaphor for what the Vote Leave campaign achieved, he praises those physicists, arguing: "It is no surprise that they can successfully invade politics and devise things that rout those who wrongly think they know what they are doing."

A rash of referendum books are being published this autumn seeking to tell the story of the referendum. We had an early stab at it in our BBC Documentary at the start of the summer.

But who won the data war is one of the (few) battles that has not yet had that much attention. Now the story of VICS is out in the public domain that might start to change.