“I don’t think there’s anyone doing anything like they’re doing right now,” said Dean Crutchfield, a brand consultant based in New York who advises young companies on marketing strategies.

Most brands, he said, are leery of doing anything political during an election cycle because they fear alienating any customers. Even an attempt at a playful ad is too risky for many companies.

“It’s so intense right now, and uptight and aggressive,” Mr. Crutchfield said of the political climate, “to position a brand flat in the middle of that fight that makes it friendly and tongue-and-cheek, I think it does stand out.”

Mr. Andrews said deciding if the company was comfortable was not easy. One complicating factor is that The Onion tries to be provocative in its advertising.

“We always push a little further than probably most brands are comfortable with, just to see how far we can go,” said Julie Scott, the general manager of Onion Labs, The Onion’s internal agency, which has worked with companies and products like Ford, Bud Light and Overstock.com.

She added: “We are always trying to maintain the same level of satire and comedy that we would write for ourselves. We’re always thinking about what our audience expects from The Onion. And we ask brands to work with us at that same level.”