BackgroundThe usage of tramadol (TR) as one of the most common analgesics is expansively growing in the world. Therefore, there is an urgent requirement for a rapid and reliable method for the on-site detection of tramadol in different samples. The elimination half-life of tramadol is about 6 h, and its removal from body is relatively slow. So, it is very critical providing a method for rapid detection of tramadol. MethodsIn this study, three magnetic nanocomposites (Fe3O4, Fe3O4/SiO2, and Fe3O4/SiO2/CMC) and molecularly imprinted polymers (MIPs) based on those in the presence of graphene quantum dots (GQDs) were synthesized and investigated for selective adsorption and detection of TR in aqueous solution. For the characterization of synthesized materials, XRD, FT-IR, SEM, VSM, and the response surface method (RSM) were also employed to optimize and estimate the effective parameters of TR adsorption by these materials. Significant findingsThe results of investigating the absorption ability of nanocomposites showed that the Fe3O4/SiO2/CMC composite has higher absorption ability than the other two nanocomposites. Moreover, Fe3O4/SiO2/CMC has an excellent ability to adsorb of TR with a removal percentage of 97.46 % at pH = 7, initial TR concentration = 15 mg/L, composite dosage = 1.5 g/L, and contact time = 6 min. According to the experimental results, the imprinting factors (IF) of MIP-Fe3O4, MIP-Fe3O4/SiO2, and MIP-Fe3O4/SiO2/CMC are 1.02, 1.72, and 2.19, respectively. Therefore, the MIP-Fe3O4/SiO2/CMC was chosen as a selective sensor, and the sensitivity of its response was investigated. The detection of TR was performed by fluorescence spectroscopy at a concentration range of TR of 0 to 250 µM, and a sensitivity of 3.13 a.u./µM and limit of detection of 2.08 µM were determined. Also, the river water and artificial urine samples (with TR of 10 µM) was detected using MIP-Fe3O4/SiO2/CMC, and the results of the sensor showed a TR concentration of river water is 9.97 µM and artificial urine is 10.456 µM and which is very good and acceptable precision.