Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Disable self-tracking with self hosting (#907)

Tatsuyuki Ishid39fbc48c283
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8586258b3a..b80c851d15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
- Disable analytics tracking when running Cypress tests
- CSV reports can be downloaded via shared links plausible/analytics#884
- Fixes weekly/monthly email report delivery over SMTP plausible/analytics#889
+- Disable self-tracking with self hosting plausible/analytics#907
## [1.2] - 2021-01-26
diff --git a/lib/plausible_web/templates/layout/_tracking.html.eex b/lib/plausible_web/templates/layout/_tracking.html.eex
index 9b068c7247..e371d1c996 100644
--- a/lib/plausible_web/templates/layout/_tracking.html.eex
+++ b/lib/plausible_web/templates/layout/_tracking.html.eex
@@ -1,4 +1,4 @@
-<%= if [email protected][:skip_plausible_tracking] do %>
+<%= if !Application.get_env(:plausible, :is_selfhost) && [email protected][:skip_plausible_tracking] do %>
<script async defer src="<%="#{plausible_url()}/js/plausible.js"%>"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<% end %>