Presumably, you are trying to see how many links on a page a user clicked to see which ones they visited. This is an unreliable strategy, as users can visit links in various ways without clicking on them (context menu, drag to a new tab, copy the location of the link, etc.).
If you want to know how many links they clicked on the current page, the answer is zero, because if they click on the link, they must go to another page. If you use a listener to prevent navigation, the same listener can also count clicks.
source share