navigator.sendBeacon() method which Matomo will use to asynchronously transfer the tracking requests over HTTPs to the Tracking API. To enable this feature call the
alwaysUseSendBeacon method as below:
[...] // enable the use of navigator.sendBeacon() _paq.push(['alwaysUseSendBeacon']); // standard Matomo tracking code below _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); [...]
Why would I use this feature? When enabling this feature, likely more of your clicks on downloads/ outlinks will be tracked and reported in Matomo (more accuracy). Also it will reduce the link tracking time to a minimum of 100ms instead of the default 500ms (default which can be increased), so that when they click on an outlink then the navigation to this clicked page will happen 400ms faster (faster and better user experience). Send beacon will only be used if the browser actually supports it.
Some ad blockers or other browser extensions may block the sendBeacon() feature which could again cause limited data loss in these cases.
Note: We are [considering enabling this by default] in Matomo 4 or later.