xref: /webtrees/resources/views/modules/matomo-analytics/snippet.phtml (revision 075d1a0567e21f051a28e4811b3293a28f1ed13f)
1<script type="text/javascript">
2    var _paq = window._paq || [];
3    _paq.push(['trackPageView']);
4    _paq.push(['enableLinkTracking']);
5    (function() {
6        var u=<?= json_encode($MATOMO_URL ?? '') ?>;
7        _paq.push(['setTrackerUrl', u+'piwik.php']);
8        _paq.push(['setSiteId', <?= json_encode($MATOMO_SITE_ID ?? '') ?>]);
9        _paq.push(['setUserId', <?= json_encode($user->username()) ?>]);
10        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
11        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
12    })();
13</script>
14