Recently, the ATOMKI experiment has reported new evidence for the excess of $e^+ e^-$ events with a mass $sim$17 MeV in the nuclear transitions of $^4$He, that they previously observed in measurements with $^8$Be. These observations could be explained by the existence of a new vector $X17$ boson. So far, the search for the decay $X17 rightarrow e^+ e^-$ with the NA64 experiment at the CERN SPS gave negative results. Here, we present a new technique that could be implemented in NA64 aiming to improve the sensitivity and to cover the remaining $X17$ parameter space. If a signal-like event is detected, an unambiguous observation is achieved by reconstructing the invariant mass of the $X17$ decay with the proposed method. To reach this goal an optimization of the $X17$ production target, as well as an efficient and accurate reconstruction of two close decay tracks, is required. A dedicated analysis of the available experimental data making use of the trackers information is presented. This method provides independent confirmation of the NA64 published results [Phys. Rev. D101, 071101 (2020)], validating the tracking procedure. The detailed Monte Carlo study of the proposed setup and the background estimate shows that the goal of the proposed search is feasible.