29 lines
1.5 KiB
HTML
29 lines
1.5 KiB
HTML
{{ if and (isset .Site.Params "matomo") (eq .Site.Params.matomo.enable true) }}
|
|
<link rel="stylesheet" type="text/css" href="{{ "assets/hugo-matomo.css" | absURL }}" />
|
|
<!-- Matomo -->
|
|
<script type="text/javascript">
|
|
var _paq = window._paq = window._paq || [];
|
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
|
{{ if and (isset .Site.Params.matomo "disablecookies") (eq .Site.Params.matomo.disablecookies true) }}
|
|
_paq.push(['disableCookies']);
|
|
{{ end }}
|
|
{{ if or (not (isset .Site.Params.matomo "requirecookieconsent")) (eq .Site.Params.matomo.requirecookieconsent true) }}
|
|
_paq.push(['requireCookieConsent']);
|
|
{{ end }}
|
|
{{ if and (isset .Site.Params.matomo "heartbeat") (eq .Site.Params.matomo.heartbeat true) }}
|
|
_paq.push(['enableHeartBeatTimer']);
|
|
{{ end }}
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
(function() {
|
|
var u="{{- .Site.Params.matomo.url -}}/";
|
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
|
_paq.push(['setSiteId', '{{- .Site.Params.matomo.id -}}']);
|
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
|
})();
|
|
</script>
|
|
<script src="{{ "assets/hugo-matomo.js" | absURL }}"></script>
|
|
<!-- End Matomo Code -->
|
|
{{ end }}
|