Companies that sell unhealthy foods to kids like walk a bit of a tightrope. They ideally want kids driving demand by asking their parents for various treats.

The problem with that, of course, is perception. It's not a good look, given the childhood obesity problem in the United States, so some companies have changed tactics.

Fast-food chains, for example, now offer healthier choices (that few kids likely pick on their own) and many have stopped putting toys in kids' meals. Now, Unilever (UL -0.86%), which owns the Breyers, Magnum, and Ben & Jerry's ice cream brands among others, has decided to commit "to new principles on marketing and advertising foods and beverages to children," according to a press release.

Kids are eating ice cream messily.

Unilever is changing how it markets. Image source: Getty Images.

What is Unilever doing?

The company has pledged to stop marketing and advertising foods and beverages -- all of the ones it makes -- kids under 12 via traditional media and under 13 on social media.

"We're implementing strict controls concerning the placement and content of our ads, and we won't use any influencers, celebrities or social media stars who primarily appeal to children under the age of 12," according to the company. "We'll also be limiting our use of cartoon characters."

Why is Unilever doing this?

While the company cites the public good in its press release, that's more of a byproduct of its actions. Basically, Unilever is getting ahead of any potential pushback to what are now considered bad marketing tactics. It's a smart move that the company can sell to consumers as commitment to doing the right thing even if that's a bit dubious.