Shares of Chipotle Mexican Grill (CMG 0.21%) rallied after the company reported second-quarter earnings on Tuesday that beat earnings expectations, but prospective investors in the burrito maker should nevertheless tread carefully.

While its shares are trading at their lowest price since 2013, they could fall further from here, depending in no small part on the direction of its same-store sales in response to the latest food-borne-illness outbreak at the chain.

Chipotle's same-store sales.

Data source: Chipotle Mexican Grill. Chart by author.

Few metrics in the retail and restaurant space are tracked as closely as same-store sales, which compare the sales at a chain's locations that have been open for at least a year. Sales in the second quarter of this year, for instance, would be compared to the second quarter of last year.

Higher same-store sales indicate that either more customers came into a particular location in a given quarter, purchased more things per order, paid more per item, or a combination of any of these three. Lower same-store sales, on the other hand, tend to mean customers have begun to shy away from a brand.

In Chipotle's case, as it grew and gained recognition among customers, it went years notching same-store sales in the double digits. Throughout 2014, for instance, the metric averaged nearly 17% for the four quarters, with a 20% increase in the third quarter of that year.

But then crisis struck. At the end of 2015, Chipotle experienced a number of food-borne-illness outbreaks at locations around the country, causing customers to avoid its stores.

A woman holds a Chipotle burrito bowl on her knee with one hand, and a fork in the other.

A Chipotle burrito bowl. Image source: Chipotle Mexican Grill.

This drove Chipotle's same-store sales down into negative territory starting in the fourth quarter of 2015 and continuing through last year. At one point, in the first quarter of 2016, comparable sales at the chain fell 30%.

It was a massive drop, and one that shook investors' faith in the company. After peaking above $740 per share in the middle of 2015, Chipotle's stock proceeded to lose more than half its value over the next 15 months.

But then things began to turn around. By the first quarter of this year, Chipotle's same-store sales were back in the black, climbing 18% in the three months ended March 31.

CMG Chart

CMG data by YCharts.

They continued in this vein in the second quarter, though to a much more modest degree. As Chipotle noted when it reported earnings on Wednesday, the figure rose 8% in the three months ended June 30.

What remains to be seen now is how the latest incidents at Chipotle -- a new norovirus outbreak earlier in July, combined with video footage of mice in one of its locations around the same time -- will factor into the trend in this pivotal metric.

The expectations are that it will once again send Chipotle's same-store sales into negative territory. That remains to be seen, but if it happens, investors should prepare for the possibility that its stock price will follow suit.