Skip to content

Commit 850039a

Browse files
authored
Add analytics (#1183)
* Add analytics only for main website
1 parent b514904 commit 850039a

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

include/header.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ if (!isset($config["languages"])) {
9191

9292
<?php if (isset($config['meta_tags'])) { echo $config['meta_tags']; } ?>
9393

94+
<?php if (is_primary_site()) { ?>
95+
<!-- Matomo -->
96+
<script>
97+
var _paq = window._paq = window._paq || [];
98+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
99+
_paq.push(["setDoNotTrack", true]);
100+
_paq.push(["disableCookies"]);
101+
_paq.push(['trackPageView']);
102+
_paq.push(['enableLinkTracking']);
103+
(function() {
104+
var u="https://analytics.php.net/";
105+
_paq.push(['setTrackerUrl', u+'matomo.php']);
106+
_paq.push(['setSiteId', '1']);
107+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
108+
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
109+
})();
110+
</script>
111+
<!-- End Matomo Code -->
112+
<?php } ?>
94113
</head>
95114
<body class="<?php echo $curr; ?> <?php echo $classes; ?>">
96115

privacy.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@
3131
<h2>Cookies</h2>
3232
<p>
3333
php.net uses cookies to keep track of <a href="/my.php">user preferences</a>. Unless
34-
you login on the site, the cookies will not be used to store personal information and
34+
you login on the site, the cookies will not be used to store personal information, and
3535
we do not give away the information from the cookies.
3636
</p>
37+
<p>
38+
We also use self-hosted analytics service to improve popular sections of the documentation,
39+
and never share user data with third parties.
40+
You may deactivate or restrict the transmission of cookies by changing the settings of your web browser.
41+
Cookies that are already stored may be deleted at any time.
42+
</p>
3743

3844
<?php
3945
site_footer();

0 commit comments

Comments
 (0)