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.

move multiple init guard to be per website ID not window

Francis Cao18a6c2995acb
diff --git a/src/tracker/index.js b/src/tracker/index.js
index a2754e906..2c15046ee 100644
--- a/src/tracker/index.js
+++ b/src/tracker/index.js
@@ -1,7 +1,4 @@
(window => {
- if (window.__umami_tracker_loaded) return;
- window.__umami_tracker_loaded = true;
-
const {
screen: { width, height },
navigator: { language, doNotTrack: ndnt, msDoNotTrack: msdnt },
@@ -30,6 +27,10 @@
const config = value => attr(`${_data}${value}`);
const website = config('website-id');
+
+ if (!window.__umami_tracker_loaded) window.__umami_tracker_loaded = new Set();
+ if (window.__umami_tracker_loaded.has(website)) return;
+ window.__umami_tracker_loaded.add(website);
const hostUrl = config('host-url');
const beforeSend = config('before-send');
const tag = config('tag') || undefined;