Monitoring population drug use through wastewater-based epidemiology (WBE) is a useful method to quantitatively follow trends and estimate total drug consumption in communities. Concentrations of drug biomarkers might be low in wastewater due to dilution; and therefore analysis of pooled urine (PU) is useful to detect consumed drugs and identify targets of illicit drugs use. The aims of the study were (1) to screen PU and urinated soil (US) samples collected at festivals for illicit drug excretion products using hyphenated techniques; (2) to develop and validate a hydrophilic interaction liquid chromatography – mass spectrometry / mass spectrometry (HILIC-MS/MS) method of quantifying urinary targets of identified drugs in wastewater; and (3) to conduct a 24 h stability study, using PU and US to better reflect the chemical environment for targets in wastewater. Cocaine (COC) and ecstasy-like compounds were the most frequently detected illicit drugs; an analytical method was developed to quantify their excretion products. Hydroxymethoxymethamphetamine (HMMA), 3,4-methylenedioxymethamphetamine (MDMA), 3,4-methylenedioxyamphetamine (MDA), HMMA sulfate (HMMA-S), benzoylecgonine (BE), and cocaethylene (CE) had 85–102% of initial concentration after 8 h of incubation, whereas COC and ecgonine methyl ester (EME) had 74 and 67% after 8 h, respectively. HMMA showed a net increase during 24 h of incubation (107% ± 27, n = 8), possibly due to the cleavage of HMMA conjugates, and biotransformation of MDMA. The results suggest HMMA as analytical target for MDMA consumption in WBE, due to its stability in wastewater and its excretion as the main phase I metabolite of MDMA. Copyright © 2016 John Wiley & Sons, Ltd.