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.

Handle target=_top links. Closes #3187

Mike Cao99edacebf446
diff --git a/src/tracker/index.js b/src/tracker/index.js
index dec52b445..6e3b65f1d 100644
--- a/src/tracker/index.js
+++ b/src/tracker/index.js
@@ -5,6 +5,7 @@
location,
document,
history,
+ top,
} = window;
const { hostname, href, origin } = location;
const { currentScript, referrer } = document;
@@ -158,7 +159,9 @@
e.preventDefault();
}
return trackElement(parentElement).then(() => {
- if (!external) location.href = href;
+ if (!external) {
+ (target === '_top' ? top.location : location).href = href;
+ }
});
}
} else if (parentElement.tagName === 'BUTTON') {