Hydrocarbons inherently present in standard high-vacuum scanning electron microscopes can be favorably used for co-deposition with functional molecules injected into the chamber. By varying the beam exposure pulse time the carbon content incorporated into the deposit can be tuned. In the particular case when the hydrocarbons are provided by surface diffusion, the composition depends also on the size of the final deposits. This dependency can be used as an additional parameter, besides the beam pulse time, in order to tune the metal/matrix ratio and to obtain new nanoscale materials with tailored physical properties. We present and discuss experimental results on composition tunability by pulsed electron-beam deposition for the two-adsorbate system Co2(CO)8/hydrocarbon and their use in fabricating Hall nanosensors of cobalt-carbon nanocomposite material with enhanced magnetic sensitivity and high magnetic spatial resolution.