1
0
Fork 0
hugo-matomo/layouts/partials/matomo_head.html

35 lines
1.9 KiB
HTML
Raw Normal View History

2021-05-13 15:39:10 +00:00
{{ if and (isset .Site.Params "matomo") (eq .Site.Params.matomo.enable true) }}
2021-05-13 23:43:49 +00:00
<link rel="stylesheet" type="text/css" href="{{ "assets/hugo-matomo.css" | absURL }}" />
2021-05-13 21:06:29 +00:00
<!-- Matomo -->
<script type="text/javascript">
2021-05-13 23:43:49 +00:00
matomoHostURL = "{{- .Site.Params.matomo.url -}}";
matomoSiteId = {{- .Site.Params.matomo.id -}};
2021-05-13 21:06:29 +00:00
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 -}}/";
2021-05-13 23:43:49 +00:00
var id=
2021-05-13 21:06:29 +00:00
_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>
2021-05-13 23:43:49 +00:00
<script src="{{ "assets/hugo-matomo.js" | absURL }}"></script>
2021-05-13 21:06:29 +00:00
{{ if and (isset .Site.Params.matomo "noscript") (eq .Site.Params.matomo.noscript true) }}
<noscript><p><img referrerpolicy="no-referrer-when-downgrade" src="{{- .Site.Params.matomo.url -}}/matomo.php?idsite={{- .Site.Params.matomo.id -}}&amp;rec=1" style="border:0;" alt="" /></p></noscript>
2021-05-13 15:39:10 +00:00
{{ end }}
2021-05-13 21:06:29 +00:00
<!-- End Matomo Code -->
2021-05-13 15:39:10 +00:00
{{ end }}