JSFiddle - React, Tailwind, and code Playground
HTML
<a href="http://jsfiddle.net/">link 1</a><br>
<a href="http://www.google.com">link 2</a><br>
<a href="http://www.google.it">link 3</a>
JavaScript
$(function(){
var clickCount=[];
$("a").on("click", function(){
clickCount[this.href] = clickCount[this.href] ? clickCount[this.href]+1 : 1;
console.log(clickCount);
return true;
});
onbeforeunload = function()
{
alert("loaded");
console.log(clickCount);
$.post('update-external-counter.php', clickCount);
}
});