Datenschutz DSGVO Cookie-Overlay V.2

Mit der Version kann man nun auch Optout-Links erstellen, um eine Entscheidung zurück zu nehmen ohne den Browser-Storage leeren zu müssen (was ein normaler Besucher sicher nicht alleine hinbekommt).


<a href="#" cookie-optout-link>Doch keine Cookies!</a>



<div id="cookiequestion">
<style type="text/css">
#cookiequestion{
position: fixed;
text-align: center;
font-weight: bold;
left: 0;
bottom: 0;
border: 2px solid #BBB;
background-color: #DDD;
padding: 10px;
border-radius: 5px;
width: 100%;
}
</style>
<script type="text/javascript">
function cookieclose(val){
var storage = window.localStorage;
if(val && val > 0){
storage.setItem("cookiequestion_val", val);
}
else {
val = storage.getItem("cookiequestion_val");
}

if(val && val > 0){
document.getElementById("cookiequestion").style.display="none";

if(val > 1) {
var event = new Event('cookiequestion_clicked', {value: val, overlay: document.getElementById("cookiequestion")});
document.dispatchEvent(event);
//or do other things here
}
}

//create optional optout-links
var elements = document.querySelectorAll("[cookie-optout-link]");
var func = function(){
return function(){
cookieclose(1);
};
};
for(var i=0; i < elements.length; i++){
elements.addEventListener("click", func());
}
};

cookieclose(0);
</script>
<p>
Erlauben von Tracking/Cookies?
</p>
<p>
<button onclick="cookieclose(2);">ja</button>
<button onclick="cookieclose(1);">nein</button>
</p>
</div>
User annonyme 2018-06-21 12:28

write comment:
Five + = 6

Möchtest Du AdSense-Werbung erlauben und mir damit helfen die laufenden Kosten des Blogs tragen zu können?