navigator.sendBeacon wrapper. Sends an HTTP request with priority
lowest to a remote host, and ensures it arrives without blocking page
navigation. Useful for sending analytics data.
Also a friendly reminder not to ever store people's IP addresses. Only store the minimum amount of data needed to inform decisions. Be kind, don't give analytics a bad name.
var nanobeacon =var url = ''var ok =var msg = ok ? 'OK' : 'NOT OK'documentbodyinnerHTML = '<h1>message status: ' + msg + '</h1>'
ok = nanobeacon(url, [data])
Send a request with a payload to a remote host.
If user has enabled Do Not Track (
window.navigator.doNotTrack) then no beacon will be sent and nanobeacon will return