This is an implementation of orestbida/cookieconsent, in German and darkmode on a website.
<script>
document.addEventListener("DOMContentLoaded", function() {
document.documentElement.classList.add('cc--darkmode');
if(typeof CookieConsent !== 'undefined') {
CookieConsent.run({
guiOptions: {
consentModal: {
layout: "box",
position: "bottom",
equalWeightButtons: true,
flipButtons: false
},
preferencesModal: {
layout: "box",
position: "right",
equalWeightButtons: true,
flipButtons: false
}
},
categories: {
necessary: {
readOnly: true
},
marketing: {}
},
language: {
default: "de",
autoDetect: "browser",
translations: {
de: {
consentModal: {
title: "",
description: "Cookie-Einstellungen",
acceptAllBtn: "Alle akzeptieren",
acceptNecessaryBtn: "Alle ablehnen",
showPreferencesBtn: "Einstellungen verwalten",
footer: "<a href=\"/datenschutz\">Datenschutz</a>"
},
preferencesModal: {
title: "Präferenzen für die Zustimmung",
acceptAllBtn: "Alle akzeptieren",
acceptNecessaryBtn: "Alle ablehnen",
savePreferencesBtn: "Einstellungen speichern",
closeIconLabel: "Modal schließen",
serviceCounterLabel: "Dienstleistungen",
sections: [
{
title: "Verwendung von Cookies",
description: ""
},
{
title: "Streng Notwendige Cookies <span class=\"pm__badge\">Immer Aktiviert</span>",
description: "Streng notwendige Cookies sind immer aktiviert.",
linkedCategory: "necessary"
},
{
title: "Marketing Cookies",
description: "Marketing Cookies, mit denen wir die Benutzererfahrung verbessern",
linkedCategory: "marketing"
}
]
}
}
}
}
});
}
window.addEventListener('cc:onConsent', ({detail}) => {
_mtm.push({"event": "marketing-concent-given"});
});
})
</script>