LIKE children eagerly awaiting Christmas, American media firms look forward to even-numbered years. Call it election affection. Every two years political campaigns spend billions of dollars on tasteful, fair-minded adverts. A spot showing Paul Ryan tossing Grandma off a cliff, which first aired last year, is typical (see picture). And where there is mud, there is moolah.

In addition to the presidential race this year, candidates are vying for 435 seats in the House of Representatives, 33 in the Senate, 11 governorships and countless local posts. In 2008 Barack Obama’s extraordinary fund-raising helped push spending on political ads to a record $4.2 billion. Can we top that? Yes, we can. Some expect this year’s haul to be 23% higher, at $5.2 billion.

The biggest profits are still to come. The mudslinging gets really messy only after the conventions (the Democratic one ended on September 6th). This is also the first presidential election to test the impact of a 2010 Supreme Court decision that allows companies and unions to spend unlimited sums on election ads. This has brought a flood of new cash to the airwaves. “Super” political action committees (PACs) have spent around $219m so far, more than Mitt Romney’s $163m and close to Mr Obama’s $263m. Restore Our Future, a super PAC that backs Mr Romney, has already spent around $82m, according to the Centre for Responsive Politics, a watchdog.

The bulk goes to local TV advertising—what David Axelrod, an adviser to Mr Obama, calls the “nuclear weapon” of elections. Local broadcasting stations are a cheaper way to reach specific audiences than national cable spots. Spending on TV will attract $3.4 billion in this election cycle, and 83% of that will go towards local TV (see chart). Most political ads appear during the local news.

Cable companies such as Comcast are courting campaign dollars by promising even more precisely aimed ad placement than is possible on local TV. As a result cable operators have quadrupled politicaladvertising revenues since 2004, to $467m, and doubled their share of the pot. But the biggest winners will be firms such as Sinclair Broadcast Group and Gray Television, which own lots of local stations in critical swing states. The 2008 presidential campaign was fought mostly in 14 swing states; this year’s will focus on a mere nine or so. Such concentration has given local stations greater pricing power, says Michael O’Brien of Scripps Media, which owns local stations in Ohio and elsewhere. As November 6th nears and advertisers snap up more of the available spots in swing states, rates will soar. Marci Ryvicker, a managing director at Wells Fargo, a bank, reckons that a spot in a swing state that normally goes for $50,000 could go for ten times that as the election approaches. This hurts non-political advertisers, who must pay more to tout their doughnuts and haircuts. Of course, they can always wait for November 7th, when prices will plunge again. As campaigns harness ever more data, they grow better at “microtargeting”: tailoring messages to specific groups of voters. This works moderately well with traditional media. For example, you can place an ad applauding or denouncing Mr Ryan’s plan for Medicare (health care for the elderly) during a TV show that old people like. Or you can send flyers to people in specific neighbourhoods or to registered independents, who may be swayable. But the greatest potential for microtargeting is online. By the end of this election cycle spending on online political ads will have increased more than tenfold since 2004 (admittedly from a low base of $30m), and will account for around 6% of advertising revenues.

Google search ads used to account for the bulk of online advertising dollars: it was a straightforward way for campaigns to provide information about their activities to those searching for it. But now social-media firms such as Facebook and Twitter are also competing for political spending.

Campaigns have started to look beyond the usual search and banner ads, and are shelling out more for video ads on popular news sites (such as CNN.com), niche websites and video sites such as YouTube, which is owned by Google. On YouTube viewers can choose which ad they want to see, and a campaign pays only if the video is actually watched. Both parties are growing more ambitious online. Whereas once they used online advertising mainly to raise money and mobilise volunteers, today they are trying to persuade people to vote for them.

The other sure winners of this election are the marketing firms that collect data about voters’ incomes, family status and web-browsing history. They sell this information to campaigns, which use it to match appropriate ads to receptive eyeballs. Zac Moffatt, Mr Romney’s digital-campaign director, says online spending is critical because it helps candidates reach “on demanders” and “people who are off the grid”: the 29% of voters who, according to a recent study by firms including Say Media, a digital consultancy, have not watched live TV in the past week.

Media firms have one or two gripes. A new ruling by the Federal Communications Commission will require broadcasters in the 50 largest markets to make public which political groups they have sold ads to, and what they have charged. That could make it harder for them to jack up prices.

Their biggest grumble, however, is that odd years follow even ones. There will be a few ballot initiatives and local races in 2013, but nothing to compare with the bonanza of a battle for the White House. So media companies should enjoy the next two months of mudslinging. Afterwards, they will have to go back to selling ads for soap powder.