Skip to content

Instantly share code, notes, and snippets.

@vdite
Created May 8, 2018 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdite/c2e4c53d12e9b44f6d883a55bb3ae3f6 to your computer and use it in GitHub Desktop.
Save vdite/c2e4c53d12e9b44f6d883a55bb3ae3f6 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html dir="LTR" lang="de">
<head>
<script type="text/javascript">
/** Disable tracking if the opt-out cookie exists. **/
if (document.cookie.indexOf('optOutPlease=true') > -1) {
/** Opt-Out Cookie set here, no tracking, no Tagmanager **/
}else{
/** Put your Javascript Google Tag Manager code beneath
.
.
.
**/
}
/** Opt-out function **/
function doOptout() {
document.cookie = 'optOutPlease=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
}
</script>
</head>
<body lang="de">
<a onclick="alert('Google Tagmanger und damit die Ausführung aller Tracking Scripte wurden deaktiviert');"
href="javascript:doOptout()">Tracking deaktivieren</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment