Skip to content

Commit aef3309

Browse files
committed
Add analytics tracker for self-hosted Matomo
1 parent bd48730 commit aef3309

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

include/header.inc

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

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

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

0 commit comments

Comments
 (0)