Files
archy/docker/justworks/business/public/assets/general-analytics.js
T

13 lines
426 B
JavaScript
Raw Normal View History

const endpoint = "https://justworks.cash/api/analytics/event";
export function trackGallery(type = "surface_interaction", action = "open") {
try {
const body = JSON.stringify({ surface: "gallery", type, action });
if (
navigator.sendBeacon?.(endpoint, new Blob([body], { type: "text/plain" }))
)
return;
fetch(endpoint, { method: "POST", body, keepalive: true }).catch(() => {});
} catch {}
}