Do you mean like storing how many clicks there are? so the most clicked on link would be the most poular?
You could always do something like,
when they click the link it takes them too www.yourwebsite.com/goto.php?url
That page stores it in the database and then uses the headers function to move them onto the next page.
However, be wary of people browsing to that address and adding in bad variables in the url