British Prime Minister David Cameron, front row center, poses for a group photograph with newly elected Conservative Party MPs at the Houses of Parliament in London on May 11, 2015. (Stefan Rousseau/Reuters)

Political pundits and pollsters expected Britain’s 2015 general election to be a tight race. Nearly every national poll had Labour and the Conservatives running neck and neck, and forecasters predicted that the election would be so close that it would result in a hung Parliament.

In the final months before the election, Labour leader Ed Miliband set his party activists an ambitious target: to out-campaign the Conservatives in the key seats, the marginal constituencies where a few votes either way could change the outcome. Research on previous elections suggested he had grounds for optimism — the more intense a party’s constituency campaign, the more votes it tends to win.

Yes, the Conservative Party surprised everyone and ended up with an overall majority in Parliament. But did Labour’s constituency campaign strategy work, at least in terms of gaining the party more votes where it most needed them?

A year later, there’s new Electoral Commission data — and our analysis of this data provides some insight on how and where the 2015 election ground war was fought, as well as what effect it had on the overall vote share.

We examined candidates’ spending on their constituency campaigns during the four weeks of the official campaign. The U.K. Parliament is elected in a first-past-the-post system, which means the candidate with the most votes wins that seat for his or her party. So it makes sense for parties to focus their campaign effort on marginal seats where there is a close gap between the incumbent and the main challenger, and worry less about seats where the result is not really in question. As the figures below illustrate, this is what has happened in 2015.

The vertical axes show Conservative, Labour and Liberal Democrat constituency campaign spending over the “short” four-week official campaign in 2015 as a percentage of the U.K. legal limit of about £14,000 per candidate. The horizontal axes show the percentage point difference between the party’s constituency vote share in 2010 and either (where it won) the second-placed party or (where it lost) the winning party. The more positive the marginality score, the safer the seat is for a party; the more negative, the further behind the party is. The vertical line indicates the most marginal seats. Smoothed running average lines reveal the underlying trends.

In 2015, Labour was the main opposition party and hoped to win back sufficient seats to form the next government. Its campaign focused on the right places to achieve this: The running average trend peaks just to the left of the most marginal vertical line in those seats where Labour lost narrowly in 2010. In seats it held comfortably in 2010 or where it was far behind, meanwhile, Labour campaigned less intensively.

Labour campaign spending in 2015 by constituency marginality. The trend line peaks just to the left of the vertical marginal line, revealing that the Labour Party spent most in those seats where it lost narrowly in 2010. DATA: UK Electoral Commission. FIGURE: Charles Pattie

The Conservative Party faced a more complex resource allocation challenge. Like all incumbent governments, it needed to hold as many of its existing seats as possible, and the party’s 2015 campaign spending was indeed highest in those seats it defended by narrow margins.

Conservative campaign spending in 2015 by constituency marginality. The trend line peaks just to the right of the vertical marginal line, revealing that the Conservative Party spent most in those seats where it won narrowly in 2010. DATA: UK Electoral Commission. FIGURE: Charles Pattie.

Here’s what was atypical for a U.K. governing party: The Conservatives did not hold an overall parliamentary majority in 2010. To form a majority government in 2015, the Tories would need to win some seats from their rivals. But the Conservatives zeroed in on those marginal seats defended by their coalition partner: In seats where they were less than 10 percentage points behind the 2010 winner, Conservatives spent an average of 62 percent of the “short campaign” limit where the incumbent was Labour — but spent 90 percent where a Liberal Democrat was the incumbent.

The Liberal Democrats, meanwhile, were in a weaker position going into the 2015 election, with few truly safe seats, low opinion poll ratings and limited campaign resources. They focused their campaign on the seats they held, but they did not limit their effort just to the most marginal of those seats, as few of their seats could be assumed to be safe.

Liberal Democrat campaign spending in 2015 by constituency marginality. The trend line reveals that Liberal Democrats spent most in seats they won in 2010, regardless of their margin of victory. DATA: UK Electoral Commission. FIGURE: Charles Pattie.

Thus, the data suggest that all three parties directed their 2015 campaigns effectively. But did their campaign spending priorities have the desired outcome? To find out, we modeled each party’s 2015 vote share by constituency as a function of how much it spent on the short campaign, controlling for its 2010 vote share in the same seat. This approach takes into account the tendency of parties to do best where they have previously done well.

The figure below pulls its data from these analyses. It shows how the party’s 2015 vote share would change if the average constituency increased its campaign spending from zero to the full amount permitted. Limited resources mean that the parties must be strategic about where they campaign.

Predicted change in a party’s 2015 vote share when moving from spending nothing to the legally permitted limit in the average constituency. The double arrows indicate 95 percent confidence intervals. DATA: UK Electoral Commission. FIGURE: Charles Pattie.

For both the Conservatives and the Liberal Democrats, the local campaign effort in 2015 significantly boosted their actual vote shares. For the Conservatives, the difference between spending nothing in the average seat and spending up to the limit resulted in an average increase in vote share of four percentage points, almost certainly helping the party toward its overall majority.

Liberal Democrats got an even bigger bump of just under 14 percentage points in vote share. Of the eight seats the party managed to hold onto in 2015, only one (Westmorland and Lonsdale) was held with a majority larger than eight percentage points. Had the party not fought hard for those seats, it could have been all but wiped out as a parliamentary force.

And what about Labour? The data suggest Labour’s local efforts didn’t significantly change the 2015 results. In past elections, Labour’s local campaign strategy worked. The party targeted its 2015 constituency campaign just as it had in previous contests, expecting a similarly beneficial outcome — but nothing happened and the party fared badly.

It isn’t altogether clear why this happened. But for a well-targeted campaign to fail so badly, one explanation is that the content of the message also matters — and how it is delivered.

Charles Pattie is professor of geography at the University of Sheffield. Ron Johnston is professor of geography at Bristol University. Todd K. Hartman is lecturer in quantitative social science at the University of Sheffield.