Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Ensure website id is passed to tracker.

Mike Cao3a6971e17374
diff --git a/src/tracker/index.js b/src/tracker/index.js
index cc6b8dbbf..97bf3bb06 100644
--- a/src/tracker/index.js
+++ b/src/tracker/index.js
@@ -193,17 +193,21 @@
/* Tracking functions */
const trackingDisabled = () =>
+ !website ||
(localStorage && localStorage.getItem('umami.disabled')) ||
(domain && !domains.includes(hostname));
const send = async (payload, type = 'event') => {
if (trackingDisabled()) return;
+
const headers = {
'Content-Type': 'application/json',
};
+
if (typeof cache !== 'undefined') {
headers['x-umami-cache'] = cache;
}
+
try {
const res = await fetch(endpoint, {
method: 'POST',