From 05b1217ceb709ac8ce04eaa20949cb1ef3267132 Mon Sep 17 00:00:00 2001
From: Ayham Kteash
Date: Wed, 23 Oct 2024 11:02:49 +0200
Subject: [PATCH 1/3] add analytics script
---
js/analytics.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 js/analytics.js
diff --git a/js/analytics.js b/js/analytics.js
new file mode 100644
index 000000000..c7a817122
--- /dev/null
+++ b/js/analytics.js
@@ -0,0 +1,53 @@
+(function () {
+ // List of URLs that do not need any analytics code
+ const noAnalyticsUrls = [
+
+
+ ];
+
+ // List of URLs that need a special version of Matomo code for obsolete websites
+ const dormantUrls = [
+ 'https://logging.apache.org/flume',
+ 'https://logging.apache.org/chainsaw/2.x/',
+ 'https://logging.apache.org/log4php',
+ 'https://logging.apache.org/log4j/1.x/',
+ 'https://logging.apache.org/log4j/extras/',
+ 'https://logging.apache.org/log4php/'
+ ];
+
+ function isUrlInList(url, list) {
+ return list.includes(url);
+ }
+
+ const url = window.location.href;
+
+ if (isUrlInList(url, dormantUrls)) {
+ // Load Matomo code for obsolete websites
+ var _paq = window._paq = window._paq || [];
+ _paq.push(["disableCookies"]);
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function () {
+ var u = "https://analytics.apache.org/";
+ _paq.push(['setTrackerUrl', u + 'matomo.php']);
+ _paq.push(['setSiteId', '42']);
+ var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
+ g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
+ })();
+ } else if (isUrlInList(url, noAnalyticsUrls)) {
+ // Do not load any analytics code
+ return
+ } else {
+ var _paq = window._paq = window._paq || [];
+ _paq.push(["disableCookies"]);
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function () {
+ var u = "https://analytics.apache.org/";
+ _paq.push(['setTrackerUrl', u + 'matomo.php']);
+ _paq.push(['setSiteId', '42']);
+ var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
+ g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
+ })();
+ }
+})();
From 7e37d11fa3aa0cfe7eaf0745aafcf8eb2842b736 Mon Sep 17 00:00:00 2001
From: Ayham Kteash
Date: Thu, 24 Oct 2024 15:19:31 +0200
Subject: [PATCH 2/3] remove old analytics script
---
_includes/footer.html | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/_includes/footer.html b/_includes/footer.html
index 7d313cb8d..d582b17fb 100644
--- a/_includes/footer.html
+++ b/_includes/footer.html
@@ -16,20 +16,4 @@
of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
From f28d3e49cecf289bb4998f8b55abd0352f2ea5c0 Mon Sep 17 00:00:00 2001
From: Ayham Kteash
Date: Thu, 24 Oct 2024 15:19:45 +0200
Subject: [PATCH 3/3] add new analytics script in header
---
_includes/header.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/_includes/header.html b/_includes/header.html
index c1b674a41..ecc99ed8b 100644
--- a/_includes/header.html
+++ b/_includes/header.html
@@ -9,5 +9,6 @@
+