Closed GoogleCodeExporter closed 9 years ago
This behavior is just how browsers work. It's not really something that
analytics.js can address. When you close a tab (or click a link to another
page, etc.) most browsers will stop executing JavaScript.
Some newer browsers implement the function `sendBeacon` to deal with this exact
issue. Here's an MDN article on the subject:
https://developer.mozilla.org/en-US/docs/Web/API/navigator.sendBeacon
If you want to use `sendBeacon` with analytics.js you can set the `useBeacon`
parameter to true:
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-r
eference#useBeacon
Original comment by philipwa...@google.com
on 3 Sep 2014 at 12:41
Original issue reported on code.google.com by
rianwouters
on 1 Sep 2014 at 1:08