clockech-script
Advanced tools
Comparing version 2.1.15 to 2.1.16
32
index.js
@@ -40,3 +40,3 @@ !(function () { | ||
const last_click = new Date().toISOString(); | ||
last_click.toLocaleString('en-US', { timeZone: 'Argentina/Buenos_Aires' }) | ||
last_click.toLocaleString("en-US", { timeZone: "America/Buenos_Aires" }); | ||
@@ -75,3 +75,3 @@ const data = { | ||
const timestamp = new Date().toISOString(); | ||
timestamp.toLocaleString('en-US', { timeZone: 'Argentina/Buenos_Aires' }) | ||
timestamp.toLocaleString("en-US", { timeZone: "America/Buenos_Aires" }); | ||
@@ -118,2 +118,30 @@ let referrer = document.referrer; | ||
document.addEventListener("visibilitychange", () => { | ||
if (document.visibilityState === "hidden") { | ||
const last_click = new Date().toISOString(); | ||
last_click.toLocaleString("en-US", { timeZone: "America/Buenos_Aires" }); | ||
const data = { | ||
id, | ||
token, | ||
last_click: new Date().toISOString(), | ||
}; | ||
console.log(data); | ||
fetch(api + "/api/data/update", { | ||
method: "PUT", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
keepalive: true, | ||
body: JSON.stringify(data), | ||
}) | ||
.then((response) => response.json()) | ||
.catch((error) => { | ||
console.error("Error on send data:", error); | ||
}); | ||
} | ||
}); | ||
if ("prerender" === document.visibilityState) { | ||
@@ -120,0 +148,0 @@ document.addEventListener("visibilitychange", () => { |
{ | ||
"name": "clockech-script", | ||
"version": "2.1.15", | ||
"version": "2.1.16", | ||
"description": "Clockech script for tracking analytics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207847
17
5007
4