Add Matomo opt-out form

This commit is contained in:
Dorian Niemiec 2024-04-25 16:40:57 +02:00
parent d6a582aa91
commit ee12475f0a
3 changed files with 37 additions and 1 deletions

View file

@ -1,8 +1,9 @@
---
title: Privacy Policy
date: 2023-12-21 18:37:50
matomooptout: true
---
_Effective date: 24.04.2024_
_Effective date: 25.04.2024_
## 1\. Introduction
@ -161,6 +162,16 @@ These third parties have access to your Personal Data only to perform these task
We may use third-party Service Providers to monitor and analyze the use of our Service.
<div id="optout-form">
<p> You may choose to prevent this website from aggregating and analyzing the actions you take here. Doing so will protect your privacy, but will also prevent the owner from learning from your actions and creating a better experience for you and other users.</p>
<p>To make that choice, please click below to receive an opt-out cookie.</p>
<p>
<input type="checkbox" id="optout" disabled />
<label for="optout"><strong id="optoutlabel">You are currently opted out, because Matomo analytics are blocked.</strong></label>
</p>
</div>
## 15\. CI/CD tools
We may use third-party Service Providers to automate the development process of our Service.

View file

@ -9,5 +9,8 @@
<script type="text/javascript" src="/js/fancyheader.js" async=""></script>
<script type="text/javascript" src="/js/indextabs.js" async=""></script>
<% } %>
<% if (page.matomooptout) { %>
<script type="text/javascript" src="/js/matomooptout.js" async=""></script>
<% } %>
</body>
</html>

View file

@ -0,0 +1,22 @@
document.addEventListener("DOMContentLoaded", function(event) {
function setOptOutText(element) {
_paq.push([function() {
element.checked = !this.isUserOptedOut();
element.disabled = false;
(document.querySelector ? document.querySelector('label[for=optout] strong') : document.getElementById('optoutlabel')).innerHTML = this.isUserOptedOut()
? 'You are currently opted out. Click here to opt in.'
: 'You are currently opted in. Click here to opt out.';
}]);
}
var optOut = document.getElementById("optout");
optOut.addEventListener("click", function() {
if (this.checked) {
_paq.push(['forgetUserOptOut']);
} else {
_paq.push(['optUserOut']);
}
setOptOutText(optOut);
});
setOptOutText(optOut);
});