mirror of
https://github.com/DerTyp7/tealcode-django-python.git
synced 2025-10-30 04:47:09 +01:00
added new google tools
This commit is contained in:
22
TealCode/main/static/js/cookies.js
Normal file
22
TealCode/main/static/js/cookies.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
function accept_cookies(){
|
||||||
|
document.cookie = "cookies_allowed=1;path=/";
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.write('<div style="background-color: rgba(255, 255, 255, 0.219);" id="cookie_banner" class="text-center"><p>We only use non-technical cookies for analysis purposes.<br> Do you want to accept those cookies? (please)</p><button class="btn btn-success mb-3" onclick="accept_cookies()">Accept</button></div>');
|
||||||
|
|
||||||
|
cookies_allowed = document.cookie.split("cookies_allowed=")[1][0]
|
||||||
|
|
||||||
|
if(cookies_allowed == null){
|
||||||
|
document.cookie = "cookies_allowed=0;path=/";
|
||||||
|
cookies_allowed = document.cookie.split("cookies_allowed=")[1]
|
||||||
|
}
|
||||||
|
if(cookies_allowed == "1"){
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', 'G-PGM5LTFSMG');
|
||||||
|
document.getElementById("cookie_banner").style.display = "none";
|
||||||
|
}else if(cookies_allowed == "0"){
|
||||||
|
console.log("DO NOT LOAD ANALYTILCS");
|
||||||
|
}
|
||||||
@@ -2,6 +2,18 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<!-- Google Analytics -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PGM5LTFSMG"></script>
|
||||||
|
<script>
|
||||||
|
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||||
|
ga('create', 'UA-213552250-1', {
|
||||||
|
'storage': 'none',
|
||||||
|
});
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
||||||
|
<!-- End Google Analytics -->
|
||||||
|
|
||||||
<!-- Required META Tags-->
|
<!-- Required META Tags-->
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
@@ -26,31 +38,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-dark">
|
<body class="bg-dark">
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<script src="{% static 'js/cookies.js' %}"></script>
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-9M4H60DMBG"></script>
|
|
||||||
<div style="background-color: rgba(255, 255, 255, 0.219);" id="cookie_banner" class="text-center">
|
|
||||||
<p>We only use non-technical cookies for analysis purposes.<br> Do you want to accept those cookies? (please)</p>
|
|
||||||
<button class="btn btn-success mb-3" onclick='document.cookie = "cookies_allowed=1;path=/";window.location.reload();'>Accept</button>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
cookies_allowed = document.cookie.split("cookies_allowed=")[1][0]
|
|
||||||
console.log(cookies_allowed)
|
|
||||||
|
|
||||||
if(cookies_allowed == null){
|
|
||||||
document.cookie = "cookies_allowed=0;path=/";
|
|
||||||
cookies_allowed = document.cookie.split("cookies_allowed=")[1]
|
|
||||||
}
|
|
||||||
if(cookies_allowed == "1"){
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
|
|
||||||
gtag('config', 'G-9M4H60DMBG');
|
|
||||||
document.getElementById("cookie_banner").style.display = "none";
|
|
||||||
}else if(cookies_allowed == "0"){
|
|
||||||
console.log("DO NOT LOAD ANALYTILCS");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<header class="p-3 bg-dark text-white shadow">
|
<header class="p-3 bg-dark text-white shadow">
|
||||||
|
|||||||
Reference in New Issue
Block a user