How to know a manual click vs a program click?

I want to set value to a variable inside the click event handler of an element :

$("#pills-tabContent").on("click", "a", function() {
    ...
    // here I want to set value to a global variable only when in manual click event
});

In some part of my code I call the click method :

$("#pills-tabContent a[data-id='"+posPrestationId+"']").click();

So how to know in the click event handler that it is a manual click ?