Context. An ever growing number of observational and theoretical evidence suggests that the deuterated fraction (column density ratio between a species containing D and its hydrogenated counterpart, D frac ) is an evolutionary indicator both in the low-and the highmass star formation process. However, the role of surface chemistry in these studies has not been quantified from an observational point of view. Aims. Because many abundant species, such as NH 3 , H 2 CO, and CH 3 OH, are actively produced on ice mantles of dust grains during the early cold phases, their D frac is expected to evolve differently from species formed only (or predominantly) in the gas, such as N 2 H + , HNC, HCN, and their deuterated isotopologues. The differences are expected to be relevant especially after the protostellar birth, in which the temperature rises, causing the evaporation of ice mantles. Methods. To compare how the deuterated fractions of species formed only in the gas and partially or uniquely on grain surfaces evolve with time, we observed rotational transitions of CH 3 OH, 13 CH 3 OH, CH 2 DOH, and CH 3 OD at 3 mm and 1.3 mm, of NH 2 D at 3 mm with the IRAM-30 m telescope, and the inversion transitions (1, 1) and (2, 2) of NH 3 with the GBT, towards most of the cores already observed in N 2 H + , N 2 D + , HNC, and DNC. Results. NH 2 D is detected in all but two cores, regardless of the evolutionary stage. D frac (NH 3 ) is on average above 0.1 and does not change significantly from the earliest to the most evolved phases, although the highest average value is found in the protostellar phase (∼0.3). Few lines of CH 2 DOH and CH 3 OD are clearly detected, and then only towards protostellar cores or externally heated starless cores. In quiescent starless cores, we have only one doubtful detection of CH 2 DOH. Conclusions. This work clearly confirms an expected different evolutionary trend of the species formed exclusively in the gas (N 2 D + and N 2 H + ) and those formed partially (NH 2 D and NH 3 ) or totally (CH 2 DOH and CH 3 OH) on grain mantles. It also reinforces the idea that D frac (N 2 H + ) is the best tracer of massive starless cores, while high values of D frac (CH 3 OH) seem fairly good tracers of the early protostellar phases, where the evaporation or sputtering of the grain mantles is most efficient.