Initial working draft.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
{{- $js := resources.Get "js/cookie-consent.js" | minify -}}
|
||||
<script src="{{ $js.RelPermalink }}" defer></script>
|
||||
|
||||
<!-- Bootstrap Bundle JS (includes Popper.js) -->
|
||||
{{ $bs := resources.Get "js/bootstrap.bundle.min.js" | fingerprint "sha512" }}
|
||||
{{ if $bs }}
|
||||
<script src="{{ $bs.RelPermalink }}" integrity="{{ $bs.Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{ end }}
|
||||
|
||||
<!-- Custom scripts -->
|
||||
{{ $custom := resources.Get "js/main.js" }}
|
||||
{{ if $custom }}
|
||||
{{ $custom = $custom | fingerprint "sha512" }}
|
||||
<script src="{{ $custom.RelPermalink }}" integrity="{{ $custom.Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{ end }}
|
||||
|
||||
{{ if eq hugo.Environment "production" }}
|
||||
<!-- Matomo -->
|
||||
<script>
|
||||
// Path 1: user just clicked Accept (event fires this session)
|
||||
window.addEventListener('cookieAccepted', loadMatomo);
|
||||
|
||||
// Path 2: user already consented in a previous visit
|
||||
if (localStorage.getItem('cookie_consent') === 'accepted') {
|
||||
loadMatomo();
|
||||
}
|
||||
|
||||
function loadMatomo() {
|
||||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="https://matomo.bovender.de/";
|
||||
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||
_paq.push(['setSiteId', '9']);
|
||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- End Matomo Code -->
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user