diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d2d5119e1ec0d4409cca67a7e7c8f690201af3..02718b5a03be2662f873a24a5e72931769931771 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-26 diff --git a/tracker/src/plausible.js b/tracker/src/plausible.js index eb460d1766296f911bbc1ca7aa52bfc28a1f024e..589c8cacd89bae445ea63bde000082e5ed06cbed 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)