Author: Derick Rethans (derickr)
Date: 2024-06-24T18:45:58+01:00

Commit: 
https://github.com/php/web-php/commit/aef3309d2508b1e1ca0db5c50c829dfdfa7ee24f
Raw diff: 
https://github.com/php/web-php/commit/aef3309d2508b1e1ca0db5c50c829dfdfa7ee24f.diff

Add analytics tracker for self-hosted Matomo

Changed paths:
  M  include/header.inc


Diff:

diff --git a/include/header.inc b/include/header.inc
index 26a13846f0..b9af95e131 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -91,6 +91,23 @@ if (!isset($config["languages"])) {
 
 <?php if (isset($config['meta_tags'])) { echo $config['meta_tags']; } ?>
 
+<!-- Matomo -->
+<script>
+  var _paq = window._paq = window._paq || [];
+  /* tracker methods like "setCustomDimension" should be called before 
"trackPageView" */
+  _paq.push(["setDoNotTrack", true]);
+  _paq.push(["disableCookies"]);
+  _paq.push(['trackPageView']);
+  _paq.push(['enableLinkTracking']);
+  (function() {
+    var u="//analytics.php.net/";
+    _paq.push(['setTrackerUrl', u+'matomo.php']);
+    _paq.push(['setSiteId', '1']);
+    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);
+  })();
+</script>
+<!-- End Matomo Code -->
 </head>
 <body class="<?php echo $curr; ?> <?php echo $classes; ?>">
 

Reply via email to