Shopware Delete cookieDeclined Cookie (Ask Again)

This snippet will check for the presence of the ‚cookieDeclined‘ cookie, which defines if a user declined the cookie tracking.
As a result, the user will be asked every time he visits the page. Until he accepts the cookie tracking.

Be careful – this is a quick&dirty solution and it is not the polite way to treat your visitors.

<script>
var delete_cookie = function(name) {
    document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
};
delete_cookie('cookieDeclined');
</script>

WHERE TO PLACE THIS CODE?

Just put the snippet where you want to check for the cookie – most of the time, a business will use it only on a specific page, like their homepage.

You can also use Google Tag Manager (or any tag manager) to set a rule and fire it where you need it.

Pleasure?

Please share your thumbsup, suggestions, edits, and questions within my comment section down there. 

I love posting snippets for you, but with a bit of feedback, it gets even more fun. 😀

Sharing is caring:

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert