Most modern browsers include the native method navigator.sendBeacon()
. It asynchronously sends a small amount of data over HTTP to a web server. AppMeasurement can use the navigator.sendBeacon()
method if the useBeacon
variable is enabled. It is useful for exit links and other situations where you want to send information before the page unloads.
If useBeacon
is enabled, the next hit sent to Adobe uses the browser’s navigator.sendBeacon()
method instead of a standard GET
image request. This variable applies to both s.t()
and s.tl()
image requests. It requires AppMeasurement 2.17.0 or higher.
AppMeasurement automatically enables useBeacon
for exit link image requests.
The useBeacon
variable is ignored when the visitor uses a browser that does not support navigator.sendBeacon()
. Use of this variable requires AppMeasurement 2.16.0 or higher.
The Document will unload checkbox within an Action Configuration determines if data sent to Adobe uses the sendBeacon API.
If this box is checked, data is sent to Adobe using the sendBeacon API. It is unchecked by default.
Set documentUnloading
to true
when sending an event. If not set, its default value is false
.
alloy("sendEvent", {
"documentUnloading": true,
"xdm": {}
});
See Using the sendBeacon API in the Web SDK documentation for more information.
There is not a dedicated field in the Adobe Analytics extension to use this variable. Use the custom code editor, following AppMeasurement syntax.
The s.useBeacon
variable is a boolean that determines if AppMeasurement uses the browser’s navigator.sendBeacon()
method. Its default value is false
. Set this variable to true
before calling a tracking function if you want to use the asynchronous nature of navigator.sendBeacon()
.
s.useBeacon = true;
After a tracking call runs, this variable is reset to false
. If your implementation sends multiple image requests in the same page load (such as single-page applications), set this variable to true
before each tracking call.