Get everything together
This commit is contained in:
parent
1be6b82419
commit
0e5c12ba90
7 changed files with 96 additions and 20 deletions
|
@ -1,21 +1,8 @@
|
|||
{{ if and (isset .Site.Params "matomo") (eq .Site.Params.matomo.enable true) }}
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
t=Matomo.getTracker("{{- .Site.Params.matomo.url -}}", "{{- .Site.Params.matomo.id -}}");
|
||||
when = t.getRememberedCookieConsent();
|
||||
|
||||
banner = document.getElementsByClassName("cookie-banner")[0];
|
||||
if (when == 0) {
|
||||
banner.style.display = 'block';
|
||||
}
|
||||
shouldShowPopup();
|
||||
}, false);
|
||||
|
||||
function dismissPopup() {
|
||||
t=Matomo.getTracker("{{- .Site.Params.matomo.url -}}", "{{- .Site.Params.matomo.id -}}");
|
||||
t.rememberCookieConsentGiven()
|
||||
banner = document.getElementsByClassName("cookie-banner")[0];
|
||||
banner.style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
<div class="cookie-banner" style="display:none">
|
||||
<p>{{ i18n "popupMsg" }}<a href="{{- .Site.Params.matomo.policyurl -}}"> <u>{{ i18n "cookiePolicy" }}</u></a>.</p>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{{ if and (isset .Site.Params "matomo") (eq .Site.Params.matomo.enable true) }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ "assets/css/hugo-matomo.css" | absURL }}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{ "assets/hugo-matomo.css" | absURL }}" />
|
||||
<!-- Matomo -->
|
||||
<script type="text/javascript">
|
||||
matomoHostURL = "{{- .Site.Params.matomo.url -}}";
|
||||
matomoSiteId = {{- .Site.Params.matomo.id -}};
|
||||
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) }}
|
||||
|
@ -17,12 +19,14 @@
|
|||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="{{- .Site.Params.matomo.url -}}/";
|
||||
var id=
|
||||
_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>
|
||||
{{ 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 -}}&rec=1" style="border:0;" alt="" /></p></noscript>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue