[Solved] How do I track when a link is clicked? [closed]


The following code will get you started.

Check out this fiddle.

Here is the snippet.

var points = 0;

$("a.ad").click(function() {
  points++;
  //send point to server
  //tell the user about the increase in points
  alert(points);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a class="ad" target="_blank" href="http://www.google.com"> This is Ad</a>
<br>
<a target="_blank" href="http://www.google.com"> This is Not an Ad</a>

3

solved How do I track when a link is clicked? [closed]