Sushant Bajracharya
Sushant Bajracharya

Reputation: 400

Clear the events effect after the event is finished running

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?

Upvotes: 0

Views: 76

Answers (1)

adeneo
adeneo

Reputation: 318182

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"});
});

Upvotes: 1

Related Questions