I am thinking of to add a javascript function to capture all the click events inside a html page.
So I am adding a global function that govern
Try jQuery and
$('a').click(function(event) { *your code here* });
In this function you can extract href value in this way:
$(this).attr('href')