I\'m trying to write a method to catch user clicks on a site menu, but I want the process to be silent for the user, mainly, that when a user hovers over an anchor tag, it w
Latest chrome browser wont complete the ajax request. Since the browser page got new url request from the user, so browser will kill the thread immediately.
98% of times you can see that the ajax request got cancelled in a network tab.
So the solution is use sendBeacon API. This will perform a POST request asynchronously.
Google analytics uses this code to perform the event trackings (Ex: click).
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
navigator.sendBeacon("{{url}}", param);