Barack Obama won re-election thanks in part to knowing what you watch on television, and his campaign bought that information from some of Hollywood’s leading data collectors. As detailed in articles in The Atlantic and the Washington Post, the campaign data-mined audience-viewing habits to zero in on where the most relevant eyeballs for their money resided, learning not only what people were watching but more importantly when they were watching and for how long.

According to the reports, the Democrats’ self-developed “optimizer” system used information from set-top cable boxes collected by Rentrak and the Microsoft-owned Navic Networks. (Rentrak, a provider of box office ticket sales used by Deadline, also collects viewing habit information via set-top boxes from more than 20 million TV sets nationwide). The real-time measurements allowed Team Obama, with a TV advertising budget estimated in the $300 million range, to put tens of thousands of ads in front of the niche audiences they were seeking, saving millions in the process. It bypassed the traditional mass buys of local news and major markets — the route taken by most previous presidential campaigns including Obama’s GOP opponent Mitt Romney — in favor of late-night shows, daytime TV, reruns and second-tier cable stations like The Food Network.

Related: Hollywood For Obama & Romney; Star Surrogates Out On Final Campaign Day

The campaign paid out more than $359,000 to Rentrak for the data, according to the Post. That information from the two services was cullied by Epsilon, a company that specializes in branded personalized message opportunities, before going to the campaign for further analysis.