I am using ahoy_matey
gem . I am trying to record click event only when specific link is clicked.
So I have tried to do the following:
$("#lotto-bigyapan").on("click", function(){
ahoy.track("name", {element: "element"});
});
It works but the only problem here is, after I click on the specific link and everthing is working then if I click somewhere else then it ges recorded too. Is there a way to clear the effect once the click is stored in the db?
To make the click event only fire once per element, you can use jQuery's one()
method
$("#lotto-bigyapan").one('click', function(){
ahoy.track("name", {element: "element"});
});