diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5bd3aa0..ed6291f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -16,6 +16,7 @@ {{ if ( .Site.Params.footer.enable ) }} {{ partial "footer/main" . }} {{ end }} + {{ partial "cookies/plausible" . }} {{ partial "scripts" . }} \ No newline at end of file diff --git a/layouts/partials/cookies/plausible.html b/layouts/partials/cookies/plausible.html new file mode 100644 index 0000000..e404a0b --- /dev/null +++ b/layouts/partials/cookies/plausible.html @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index a94ee68..f7a9d6a 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -2,4 +2,4 @@ - + diff --git a/static/js/plausible-exclude.js b/static/js/plausible-exclude.js new file mode 100644 index 0000000..e417d0e --- /dev/null +++ b/static/js/plausible-exclude.js @@ -0,0 +1,22 @@ +// Plausible Exclude +const plausibleBanner = document.getElementById('plausible-banner'); +var hidePlausibleBanner = window.localStorage.getItem('hidePlausibleBanner'); + +function disablePlausible(e) { + window.localStorage.setItem('plausible_ignore', 'true'); + window.localStorage.setItem('hidePlausibleBanner','true'); + plausibleBanner.classList.add('hidden'); +} + +function enablePlausible(e) { + window.localStorage.removeItem('plausible_ignore'); + window.localStorage.setItem('hidePlausibleBanner','true'); + plausibleBanner.classList.add('hidden'); +} + + +if ( hidePlausibleBanner){ + plausibleBanner.classList.add('hidden'); +} else { + plausibleBanner.classList.remove('hidden'); +} \ No newline at end of file