The mechanisms of charmonium production in the high-density medium created in heavy ion collisions are still not quantitatively understood. In order to disentangle among different mechanisms which changes the charmonium cross section, a multi-dimensional analysis is needed in a wide kinematic range and in various collision systems (pp, pA and AA). This paper will present the first measurement of the prompt and non-prompt J/ψ production with the CMS detector from the pPb collisions at with an integrated luminosity of 34.6 nb−1 in 2013. The ratio of the forward and backward production yields is measured in bins of pT and rapidity of J/ψ, as well as the event activity.