Remove Google Analytics.

Google shut down the Universal Analytics script that the pages loaded,
and we haven't used it probably a decade
This commit is contained in:
tim
2026-09-26 15:27:51 +02:00
parent 77800174c9
commit 65426a327d
5 changed files with 19 additions and 18 deletions
-3
View File
@@ -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=
-1
View File
@@ -2,4 +2,3 @@
All stories and submissions <a class="whitefont" href="about">&copy;</a> 2003&ndash;<?php echo gmdate("Y"); ?> their respective authors.
</p></footer>
<?php $_SESSION['referrer'] = $_SERVER['REQUEST_URI']; ?>
<?php include_once('google.inc.php'); ?>
-13
View File
@@ -1,13 +0,0 @@
<?php
$ga_id = config('GOOGLE_ANALYTICS_ID');
if (! $is_admin && $ga_id) { ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', <?= json_encode($ga_id, JSON_HEX_TAG) ?>, 'auto');
ga('send', 'pageview');
</script>
<?php } ?>
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Xxx\Tests\Pages;
use Xxx\Tests\Support\PageTestCase;
// The site has no Google Analytics, even with the old GOOGLE_ANALYTICS_ID in the environment
class NoAnalyticsTest extends PageTestCase {
protected static function serverEnv(): array {
return array('GOOGLE_ANALYTICS_ID' => '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);
}
}
}
-1
View File
@@ -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=