Add plausible.io as alternative to Google Analytics

- does not require cookies, and thus no cookie consent
This commit is contained in:
Thomas Jensen 2021-05-01 11:37:46 +02:00
parent bce05c6575
commit b23a567293
No known key found for this signature in database
GPG Key ID: 54243EF8EA4945B2
4 changed files with 21 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/_site/
/_support/
/.jekyll-metadata
/.jekyll-cache/

View File

@ -46,6 +46,14 @@ ga:
cookieconsent: true
anonymizeip: true
# Plausible.io Analytics (alternative to Google Analytics that does not need cookies -> no cookie consent required)
# A config setting is required in plausible to enable tracking of the outbound links. Details described here:
# https://plausible.io/docs/outbound-link-click-tracking
# Leave empty (just "plausible:" with subitems commented out) to disable.
#plausible:
plausible:
domain: 'tsjensen.github.io'
# A picture of you, square(!), at least 180x180 pixels, more is better. Recommended file size < 100 KB.
# Leave empty for generic placeholder image.

View File

@ -1,5 +1,6 @@
{% if site.ga %}
<!-- Google Analytics -->{% comment %} should be the first script in the HEAD section {% endcomment %}
{%- if site.ga and site.ga.account %}
<!-- Google Analytics -->
{% comment %} should be the first script in the HEAD section {%- endcomment -%}
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ site.ga.account }}', 'auto');{% if site.ga.anonymizeip %}
@ -18,4 +19,9 @@
document.location = targetUrl;
}
}
</script>{% endif %}
</script>
{%- endif %}
{%- if site.plausible and site.plausible.domain %}
<script async defer data-domain="{{ site.plausible.domain }}" src="https://plausible.io/js/plausible.outbound-links.js"></script>
{%- endif -%}

View File

@ -28,7 +28,7 @@ permalink: /
<meta name="theme-color" content="#ffffff">
<!-- Stylesheets -->
{% comment %} Bootstrap should be the first stylesheet {% endcomment %}
{%- comment -%} Bootstrap should be the first stylesheet {%- endcomment %}
<link rel="stylesheet" type="text/css" crossorigin="anonymous"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk">
@ -39,7 +39,7 @@ permalink: /
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&subset=latin">
{% if site.ga and site.ga.cookieconsent %}
{% if site.ga and site.ga.cookieconsent -%}
<!-- Cookie Consent popup to comply with EU cookie law -->
<link rel="stylesheet" type="text/css" crossorigin="anonymous"
href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css"
@ -59,7 +59,7 @@ permalink: /
});
});
</script>
{% endif %}
{%- endif %}
</head>
<body class="fullscreen-background">