Your beer can tell you where you’ve been, according to a new study by researchers in Utah. No, not because of the strength of your hangover — it’s all about chemistry.

Beer, bottled water and soda have a natural chemical signature related to geographic location, and drinking them leaves a chemical fingerprint in your hair. The fingerprint could be used to track your travels over time, according to the study, published in the Journal of Agricultural and Food Chemistry.

It works by measuring different isotopes of oxygen and hydrogen. The proportion of those isotopes varies according to geographic differences like altitude and latitude — it’s different in Denver compared to Dallas or Des Moines, according to the American Chemical Society. The differences yield an “iso-signature” that can be tied to specific regions.

This signature shows up in your hair. As ACS explains, the body removes hydrogen and oxygen atoms from water and incorporates them into proteins, including keratin, which is in your hair. This means the hydrogen and oxygen isotopes would show up in those proteins, and if you know which isotope patterns exist in which spots, you can deduce where — if not what — someone had been drinking.

To test this theory, the scientists analyzed tap water from 33 cities and looked at isotope patterns in Dasani bottled water, Coca-Cola Classic and Budweiser. They found the beverage isotope pattern from those cities matched the tap water pattern — which makes sense, because many beverage companies produce their drinks regionally instead of in one main location. For example, if you drink a Bud in Utah, it probably came from the Anheuser-Busch plant in Fort Collins, Colo., not St. Louis.

The study could tell the difference, although the regional isotopic signatures of beer and soda were not as strong. The authors say this might be because the manufacturing process changes the water’s chemistry, making the isotopic correlation less obvious.

Other exceptions would include regionally produced bottled water, which comes from a specific spring, and some national brands.

But for the most part, bottled beverages can be used to deduce purchase location, the authors say. The data could allow forensic investigators to predict the original source of the water in your beer, and thus figure out where you’ve been.

American Chemical Society