24 lines
789 B
Plaintext
24 lines
789 B
Plaintext
---
|
|
/**
|
|
* The Matomo tracker: a page view per page, outgoing links and downloads, no cookies, Do Not
|
|
* Track honoured. matomo.js loads async from our own Matomo, so it never holds up the page.
|
|
*/
|
|
import { matomo } from '../data/analytics';
|
|
const { url, siteId, enabled } = matomo;
|
|
---
|
|
{enabled && (
|
|
<script is:inline define:vars={{ url, siteId }}>
|
|
var _paq = (window._paq = window._paq || []);
|
|
_paq.push(['setDoNotTrack', true]);
|
|
_paq.push(['disableCookies']);
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
_paq.push(['setTrackerUrl', url + 'matomo.php']);
|
|
_paq.push(['setSiteId', siteId]);
|
|
var s = document.createElement('script');
|
|
s.async = true;
|
|
s.src = url + 'matomo.js';
|
|
document.head.appendChild(s);
|
|
</script>
|
|
)}
|