From 65426a327d21902e78103ebba9fd6bea98886be7 Mon Sep 17 00:00:00 2001
From: Timothy Allen
Date: Sat, 26 Sep 2026 14:27:01 +0200
Subject: [PATCH] Remove Google Analytics.
Google shut down the Universal Analytics script that the pages loaded,
and we haven't used it probably a decade
---
.env.example | 3 ---
bottombar.inc.php | 1 -
google.inc.php | 13 -------------
tests/php/Pages/NoAnalyticsTest.php | 19 +++++++++++++++++++
tests/php/fixtures/test.env | 1 -
5 files changed, 19 insertions(+), 18 deletions(-)
delete mode 100644 google.inc.php
create mode 100644 tests/php/Pages/NoAnalyticsTest.php
diff --git a/.env.example b/.env.example
index ef1d6ac..dd7f87b 100644
--- a/.env.example
+++ b/.env.example
@@ -23,9 +23,6 @@ RECAPTCHA_SITE_KEY=
RECAPTCHA_PROJECT_ID=
RECAPTCHA_API_KEY=
-# Google Analytics tracking ID. Leave it empty to turn analytics off.
-GOOGLE_ANALYTICS_ID=
-
# Directory for uploaded images waiting to be saved. Keep it outside the
# web root. The default is xxx-uploads in the system temporary directory.
UPLOAD_DIR=
diff --git a/bottombar.inc.php b/bottombar.inc.php
index ab945da..459f10b 100644
--- a/bottombar.inc.php
+++ b/bottombar.inc.php
@@ -2,4 +2,3 @@
All stories and submissions © 2003– their respective authors.
-
diff --git a/google.inc.php b/google.inc.php
deleted file mode 100644
index 2371f4a..0000000
--- a/google.inc.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
diff --git a/tests/php/Pages/NoAnalyticsTest.php b/tests/php/Pages/NoAnalyticsTest.php
new file mode 100644
index 0000000..98777b8
--- /dev/null
+++ b/tests/php/Pages/NoAnalyticsTest.php
@@ -0,0 +1,19 @@
+ 'UA-12345-1');
+ }
+
+ public function testNoPageLoadsAnalytics(): void {
+ foreach (array('/', '/article', '/about', '/publish', '/publish/login') as $path) {
+ $body = $this->get($path)['body'];
+ $this->assertStringNotContainsString('UA-12345-1', $body, $path);
+ $this->assertStringNotContainsString('google-analytics', $body, $path);
+ }
+ }
+}
diff --git a/tests/php/fixtures/test.env b/tests/php/fixtures/test.env
index 5c387ef..4b77a84 100644
--- a/tests/php/fixtures/test.env
+++ b/tests/php/fixtures/test.env
@@ -7,7 +7,6 @@ SITE_URL=https://site.test
RECAPTCHA_SITE_KEY=test-site-key
RECAPTCHA_PROJECT_ID=test-project
RECAPTCHA_API_KEY=test-api-key
-GOOGLE_ANALYTICS_ID=
UPLOAD_DIR=
UPLOAD_DIR_LIMIT_MB=1
DISPLAY_ERRORS=