The ALICE collaboration has measured the inclusive charmonium production at forward rapidity in Pb–Pb and p–Pb collisions at sNN=5.02TeV and sNN=8.16TeV, respectively. In Pb–Pb collisions, the J/ψ and ψ(2S) nuclear modification factors (RAA), as well as the J/ψ elliptic flow (v2) and averaged squared transverse momentum (〈pT2〉), are presented. In p–Pb collisions, the J/ψ nuclear modification factor (RpPb) as a function of pt and rapidity is presented. In both systems, our measurements are compared to theoretical calculations and to the results at lower energies.