Author: Sergey Panteleev (saundefined)
Committer: GitHub (web-flow)
Pusher: derickr
Date: 2024-12-10T11:29:57Z

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

Add analytics (#1183)

* Add analytics only for main website

Changed paths:
  M  include/header.inc
  M  privacy.php


Diff:

diff --git a/include/header.inc b/include/header.inc
index 5e6ae335ef..2f33d64c55 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -91,6 +91,25 @@ if (!isset($config["languages"])) {
 
 <?php if (isset($config['meta_tags'])) { echo $config['meta_tags']; } ?>
 
+<?php if (is_primary_site()) { ?>
+<!-- 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="https://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 -->
+<?php } ?>
 </head>
 <body class="<?php echo $curr; ?> <?php echo $classes; ?>">
 
diff --git a/privacy.php b/privacy.php
index 7a912bb479..ce1b25f4e2 100644
--- a/privacy.php
+++ b/privacy.php
@@ -31,9 +31,15 @@
 <h2>Cookies</h2>
 <p>
  php.net uses cookies to keep track of <a href="/my.php">user preferences</a>. 
Unless
- you login on the site, the cookies will not be used to store personal 
information and
+ you login on the site, the cookies will not be used to store personal 
information, and
  we do not give away the information from the cookies.
 </p>
+<p>
+ We also use self-hosted analytics service to improve popular sections of the 
documentation,
+ and never share user data with third parties.
+ You may deactivate or restrict the transmission of cookies by changing the 
settings of your web browser.
+ Cookies that are already stored may be deleted at any time.
+</p>
 
 <?php
 site_footer();

Reply via email to