WASHINGTON — The surprise sweep for marriage equality efforts at the polls in 2012 came after a dramatic shift in the television ads their backers ran — a change that came about after a yearlong research effort to crack the code of previously successful ads run by marriage-equality opponents that focused on "gay marriage" being taught in schools.

Among the key changes were a shift away from talk of "rights" to a focus on committed relationships; a decision to address "values" directly as being learned at home; and an attempt to give voters "permission" to change their minds, according to elements of the research shared with BuzzFeed.

The research was "instrumental in helping us figure out our path," said Zach Silk, who served as the campaign manager to approve Washington's Referendum 74.

The research was sponsored by Third Way — a centrist Democratic think tank — that conducted an extended round of surveys beginning in September 2010 "aimed at answering a single question: How do we most effectively persuade people in the middle to support relationship recognition for gay and lesbian couples, including marriage?"

National groups like the Human Rights Campaign and Freedom to Marry have highlighted their engagement, direct giving, and fund-raising for the states' efforts — which were significant — noting longtime partnerships and support provided throughout the states. The national groups also have been careful to credit state organizations with tremendous leadership in getting the volunteer base and coalition support necessary to win their ballot measures and for addressing the specifics of the states’ dynamics, from Maryland and Washington, where referenda on marriage laws were passed, to Maine, where a marriage equality initiative was approved, to Minnesota, where a marriage amendment was defeated for only the second time.

Each group ran a different campaign, based on the local demographics, geography, and past experience. Washington advocates, in 2009, had succeeded in approving a referendum to allow the state’s domestic partnership law to go into effect. In Maine, also in 2009, a referendum on a marriage equality law passed by the legislature resulted in the law being rejected by the voters. In Minnesota, advocates had time to prepare, as the measure was put on the 2012 ballot in spring 2011. People in Maryland had been engaged on the issue for more than a year as well, as the legislature had considered a marriage equality bill in 2011 before passing it in 2012.

Faith and, particularly in Maryland, black communities were engaged directly. Fund-raising and field operations were systematic and far outpaced past efforts of marriage equality supporters and this year's efforts by opponents. Social media, in its infancy in 2008, was a key part of campaigns' and outside engagement. President Obama and the Democratic Party, along with prominent Republicans and straight sports stars, were speaking out in support of marriage equality. And, it was the fifth federal election held in the country since some of its residents were legally able to marry someone of the same sex.

All of those very big changes since California voters approved Proposition 8 in 2008 could have made the difference in the four states this time around.

But, for those who have been watching the campaigns — including HRC's new president, Chad Griffin — there was another change too: the ad campaigns.

At a post-election wrap-up on LGBT issues organized by the Williams Institute on November 13, Griffin — who lived in California before returning to DC earlier this year to run HRC — talked about how slow the campaign in California had been to respond to the Proposition 8 campaign's "Princess" ad, which featured a child talking about how she was taught in school that a "prince married a prince" and that she "can marry a princess."