From d3c43137f5441dfdec576a50e6898d99cdce9eb4 Mon Sep 17 00:00:00 2001
From: Ashley <iamashley@duck.com>
Date: Sun, 26 Nov 2023 09:53:09 +0000
Subject: [PATCH] add anonymous title for matomo

---
 html/poketube.ejs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/html/poketube.ejs b/html/poketube.ejs
index 2dd08841..9bc80ec7 100644
--- a/html/poketube.ejs
+++ b/html/poketube.ejs
@@ -1741,10 +1741,20 @@ if (userID) {
 
 <% if(secure) { %>
   <!-- Matomo -->
+<script>
+  function anondocumenttitle(input, times) {
+  let result = input;
+  for (let i = 0; i < times; i++) {
+    result = btoa(result);
+  }
+  return result;
+  }
+</script>
+  
 <script>
   var _paq = window._paq = window._paq || [];
   /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
-  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
+  _paq.push(["setDocumentTitle", anondocumenttitle(document.domain, 5) + "/" + anondocumenttitle(document.title, 5)]);
   _paq.push(["setDoNotTrack", true]);
   _paq.push(["disableCookies"]);
   _paq.push(['trackPageView']);