if i have a link say

<a href="http://www.google.com">google</a>

and i want to register the clicks to that link


use something like linking to redirectexit.php?siteid=20 (php approach)

or use an onclick on the link to trigger javascript to enter it into the database.
does this approach work? and where can i find more about it?