Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Stop analytics tracking if running under Cypress tests (#850)
Iiro Krankkadde5116a7676
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 55d2d5119e..02718b5a03 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.### Fixed- Capitalized date/time selection keybinds not working plausible/analytics#709- Invisible text on Google Search Console settings page in dark mode plausible/analytics#759+- Disable analytics tracking when running Cypress tests## [1.2] - 2021-01-26diff --git a/tracker/src/plausible.js b/tracker/src/plausible.jsindex eb460d1766..589c8cacd8 100644--- a/tracker/src/plausible.js+++ b/tracker/src/plausible.js@@ -18,7 +18,7 @@function trigger(eventName, options) {if (/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/.test(location.hostname) || location.protocol === 'file:') return warn('localhost');- if (window.phantom || window._phantom || window.__nightmare || window.navigator.webdriver) return;+ if (window.phantom || window._phantom || window.__nightmare || window.navigator.webdriver || window.Cypress) return;if (plausible_ignore=="true") return warn('localStorage flag'){{#if exclusionMode}}if (excludedPaths)