Yorkville, Illinois (CNN Business) It takes the maker of M&M's, Skittles and Snickers two years to get ready for Halloween .

Before coming up with a new product, Mars Wrigley polls customers on what they want. Its food scientists test out several variations and perfect their recipes. Then its marketing team pulls together a plan to ensure the candy makes a splash. Only then can stores place their orders — months ahead of Halloween — and figure out how to display them.

It's a lot of work. But it's worth it.

"Halloween is our No. 1 season at Mars ... [and it] continues to become increasingly important," Tim LeBel, president of sales for Mars Wrigley in the United States, told CNN Business.

Halloween is one of the rare occasions when candy appears on people's shopping lists. Otherwise, people tend to buy candy on impulse — and that urge is weaker when they're shopping online. Although candy sales are steady, e-commerce is "one of the things that I think keeps candy makers up at night," said Crystal Lindell, editor of Candy Industry Magazine.

So when this candy-centric holiday comes around, Mars Wrigley and others pull out all the stops. To get the most out of Halloween, Mars Wrigely has to jazz up it core items, spark a conversation online and take full advantage of the eight-week-long Halloween season in stores. Yes, eight weeks.

Bringing Halloween to Skittles

In 2016, Mars Wrigley poured $50 million into its Yorkville, Illinois, candy factory to expand the facility — which also makes Life Savers and Doublemint and Juicy Fruit gums — and add a Skittles production line. Today, Skittles branding is featured prominently throughout the space — in office conference rooms, hallways and throughout the sprawling, sweet-scented factory itself, where the candies are made and packaged.

With such a big investment in its candy brands, Mars needs to keep people interested.

One of this year's notable creations, Zombie Skittles, have already made a splash. The candy comes in a gray, ominous-looking package, each containing several sweet Skittles and some that taste ... a little off. For some, the "Zombie" flavor may resemble fruit gone bad. Some identify the tang of garlic, and others a hint of meat. Mars won't disclose what "Zombie" actually is, but it's supposed to taste unpleasant enough to elicit a reaction — but not so awful as to turn you off Skittles for good.

YouTube is filled with videos of people trying and reacting to Zombie Skittles.

"We wanted to put a twist on what our delicious flavors are," said Caitlin Hubbard, a product development scientist for Mars. "However, we didn't want it to be too twisty, that it would scare you from eating the rest of the bag."

Mars found through its research that younger consumers especially are interested in an element of surprise. The product itself was designed to appeal to those shoppers. And to make sure they know it's out there, Mars tried to make it go viral.

"We truly believe it's going to have a halo effect on Skittles original," LeBel said.

#DareTheRainbow

When Mars first announced Zombie Skittles, it encouraged consumers to shoot video of themselves and their friends trying the flavor, and sharing it on social media with the hashtag #DareTheRainbow. Getting people excited about candy helps "keep consumers engaged," said LeBel, and makes sure that they keep coming back to products like Skittles.

Zombie Skittles are here, try them if you dare. Are you brave enough to #DareTheRainbow and take your chances on getting a Zombie flavored Skittles? pic.twitter.com/s7PWKkD9NC — Skittles (@Skittles) August 22, 2019

"When they hit the nail on the head, it goes fantastic for them," said Lindell. The gold standard of a viral candy campaign, she added, is rival Jelly Belly's BeanBoozled challenge.

The BeanBoozled challenge, which has taken place for years, is simple. Customers buy a special box of Jelly Beans that includes both traditional, sweet flavors and their unappetizing doubles. For example, in a BeanBoozled box of jelly beans, a yellow and white jelly bean is either buttered popcorn or rotten egg, a white jelly bean is either coconut or spoiled milk, and so on (LeBel said that Zombie Skittles were not inspired by the BeanBoozled beans).

On YouTube, videos of celebrities reacting to the jelly beans have garnered millions of views. Jelly Belly sells the candies in a special gift box equipped with a spinner that tells players which flavor they have to try. Customers can even download a BeanBoozled challenge app to their phones.

That type of hype can raise awareness and excitement around a product and drive sales. But Mars doesn't just want its products to cause an online stir. It needs Halloween items to pull people into stores and fly off retail shelves throughout the eight-week-long season.

Sixty days of Halloween

People may complain about seeing fall products — like seasonal lattes or Halloween candy — on shelves in the summer, but that doesn't mean they don't buy them.

"If you're putting Halloween candy out in August, there's a reason," said Lindell. "It does sell that early."

For retailers looking to increase foot traffic, it's a way to bring people into stores. "Halloween is truly a mutual opportunity with retailers," LeBel noted. People popping into stores to pick up their Halloween candy might also pick up additional items — an important opportunity for retailers, especially if they're losing out to competition online.

But the candy must be a big enough draw.

"If the Halloween season and Mars Wrigley products were not delivering, we would not get eight weeks. We would not get six weeks," said LeBel. "The extension of the season tells you how important Halloween is to our business partners."

To lure customers, Mars and retailers put together big store displays and lean on an increasingly enthusiastic Halloween demographic: grown ups.

"Adults have taken to costumes, parties, and candies in a big way," Marcia Mogelonsky, director of insight of food and drink for Mintel, a research company, told CNN Business in an email. "Candy makers are playing into the 'aging' of the holiday with more sophisticated treats," she added. "There are still gummy eyeballs and brains for the kids, but there are also products like Mystery Double Dark Chocolate Brownie chocolate bars."

For adults, Halloween is not just about nostalgia but also the changing seasons — more of an autumnal celebration than a day to gorge on candy. Now, the two months of Halloween season are split into three rough stages, said LeBel. The first is baking, when people start whipping up fall-themed treats in their kitchens and add holiday-themed M&Ms or other candies to their recipes. After baking comes celebrating, when customers buy candy for their Halloween parties.

And finally, there's the main event: trick-or-treating.

That's "where the majority of our sales come from," LeBel said.