I am trying to use Facebook conversion code like below that includes
both scripts and noscripts tags:
Have you tried using the JavaScript onclick event? For example:
var el; // This is your element pointing to the link you want to handle
el.onclick = function() {
// Execute your code here, this event is fired before the default behaviour is executed which is to lead the user to the URL
};
If your el has an ID of mylink, then you can simply assign el as
var el = document.getElementById('mylink');
This code becomes even simpler to handle if you're using a JS library like jQuery but for the moment I'm assuming you're not.