McDonald's (MCD -0.53%) investments in technology finally began paying off in the second quarter, as the fast-food chain reported global sales were their highest in seven years and comparable-store sales were at a four-year peak. But all the money being spent to upgrade its restaurants and improve the speed and quality of order fulfillment still isn't bringing customers into its stores.

CFO Kevin Ozan told analysts on the earnings conference call that traffic was still negative in the second quarter, though slightly less than it had been in the first, as it benefited from the calendar shift of the Easter holiday into the current period. Ozan said that "returning to guest count growth in the U.S. remains a top priority in the street fight for market share."

Mobile phone showing McDonald's delivery app

Improvements to McDonald's mobile technology, including delivery, helped boost sales in Q2. Image source: McDonald's.

Technology is turning the tide

The burger joint is remodeling its stores, adding technology to drive-thru windows and the kitchen, and streamlining its menu, while also introducing new promotions like the Filet-O-Fish sandwich during Easter, Donut Sticks, and bundles like the 2-for-$5 Mix and Match deal.

McDonald's has also deployed digital self-order kiosks, added mobile pay and pickup to its mobile app, added fresh beef to a number of its burger offerings, and this month expanded its order delivery options by inserting DoorDash into its already existing (and formerly exclusive deal) with Uber Eats.

While the refranchising of company-owned stores limited currency-adjusted sales to just a 3% increase to $5.3 billion, the combination of all the tech investments helped global comps jump 6.5% in the quarter. All segments saw gains, while the all-important U.S. market was up 5.7%, handily beating analyst estimates of 4.5% growth.

McDonald's top-line U.S. sales grew because of an increase in average check size, both from product mix and higher prices, but it's still missing out on one of the most important aspects of comps: customer traffic.

Breakfast competition is holding McDonald's back

A big reason why guest counts at the burger chain continue to slip is the increased competition surrounding the morning daypart, which has long been critical to McDonald's success. While limited-time offers like Donut Sticks did help sales grow in the quarter, the company has not been able to increase the number of people visiting its restaurants.

"There's been plenty of other entrants who are competing in the breakfast market," CEO Steve Easterbrook said. That's why Ozan likened growing traffic to a street fight, and it also explains why McDonald's in May began allowing franchisees to decide which all-day breakfast items they would sell.

Yet Easterbrook says momentum is growing and moving its way. As the company invests more money into its 14,000 stores, the changes are becoming "apparent to our customers," and investors can expect more change in the future.

Going global for growth

McDonald's is upgrading 2,000 U.S. stores this year, half of which have been already completed, and it will be deploying its new Dynamic Yield artificial intelligence drive-thru technology at 8,000 restaurants over the next few weeks. The fast-food giant will also begin expanding the initiative internationally, and by the end of the year, all the restaurants in the U.S. and Australia will have the new interactive menus.

Delivery is another big opportunity McDonald's will take advantage of, one it estimates will be a $4 billion contributor to global sales this year, as it has enjoyed double-digit delivery sales growth in major markets over the past 12 months. In the U.K. and Spain alone, delivery now accounts for more than 10% of sales in restaurants that offer it.

Customer traffic is still the missing ingredient for McDonald's, but the company is counting on technology to turn the tide.