Skip to content

Commit

Permalink
Add analytics (#1183)
Browse files Browse the repository at this point in the history
* Add analytics only for main website
  • Loading branch information
saundefined authored Dec 10, 2024
1 parent b514904 commit 850039a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 19 additions & 0 deletions include/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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; ?>">

Expand Down
8 changes: 7 additions & 1 deletion privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 850039a

Please sign in to comment.