I think it would be best to do it from the server. So each time a page loads, the database is updated.
This will also allow for easier viewable and editable data.
The only drawback -- this will only work for local links. So if you had a link to google.com, the link counter wont record it.
If you want to use this method, find out which server side languages your server supports and then post your details in the corresponding forum..
Some languages include; ASP, CGI, PHP, ColdFusion, ASP.NET.