From a33293066e746d9082a4de61a803cf3ed1556f92 Mon Sep 17 00:00:00 2001 From: rohandebsarkar Date: Sun, 22 May 2022 23:18:26 +0530 Subject: [PATCH] Update `tracker/index.js`: `SendBeacon()` to Fetch API --- tracker/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tracker/index.js b/tracker/index.js index d7ccb86f..f6329633 100644 --- a/tracker/index.js +++ b/tracker/index.js @@ -122,7 +122,11 @@ import { removeTrailingSlash } from '../lib/url'; payload, }); - navigator.sendBeacon(`${root}/api/collect`, data); + fetch(`${root}/api/collect`, { + method: 'POST', + body: data, + keepalive: true, + }); }; const addEvents = node => {