CHICAGO — You know a lot about McDonald's, but McDonald's doesn't know much about you.

At least not yet.

By year's end, the world's largest burger chain will roll out nationwide a mobile ordering system that will collect a wealth of data about the habits of customers — everything from what kind of burgers they prefer to how often they swing through the drive-through.

McDonald's plans to use the information to customize the way it interacts with diners. Imagine, for example, having the McDonald's app on your phone suggest a milkshake to go with your twice-weekly Quarter Pounder order.

Despite a management shake-up at McDonald's last week that saw the departures of the heads of marketing, menu strategy and digital, analysts expect the chain's innovation plans to continue moving forward.

The ability to collect data on customers is important to McDonald's, which is trying to reverse a yearslong decline in customer traffic. The move also places the fast-food giant, which lagged in the race to introduce new technology like mobile ordering and payment, as a leader among chain restaurants in translating customer data into customized service.

Through loyalty programs and apps, companies have for years been gathering information on customers to increase visits and sales. But the chance to collect data and use it to make a customer's experience better and faster is still a relatively new frontier, said David Pierpont, an executive vice president at marketing firm Ansira.

"Consumers are willing to share data if the benefits are right," he said. "I think you're going to see more and more. Everyone's trying to figure out how can they leverage it."

Millennials and the younger Gen Z set tend to be more open to their data being shared, but Pierpont believes acceptance of data-sharing is more widespread than many people admit.

"They say they don't want to give everything away, but they're on Facebook, they're on Google," he said, noting that about 90 percent of Facebook's users keep location services on, allowing Facebook ads to target consumers based on their location.

McDonald's has had a smartphone app for several years, but it's primarily been focused on delivering coupons and store location maps. The ability to order food and pay through the app, which is expected at all U.S. restaurants by the last three months of the year, is already in place — and spurring sales — in some of the chain's international markets.

In Japan, McDonald's has found that customers using the app spend 35 percent more, on average. The app makes it easy to place orders, so customers return more often, McDonald's Global Chief Marketing Officer Silvia Lagnado said.

The new initiatives come at a time when the company is trying to improve customer traffic in the U.S., which has been in decline for years.