Cotinine is the principal metabolite of nicotine:

Cotinine spends quite awhile in the body; it can take several days to eliminate, so it’s a marker for recent exposure to tobacco (secondhand smoke counts). This makes it one of the few drugs other than marijuana that will reliably show up on a drug test.