summaryrefslogtreecommitdiff
path: root/Static/Js
diff options
context:
space:
mode:
authorDebulois <quentin@debulois.fr>2022-05-09 20:03:42 +0200
committerDebulois <quentin@debulois.fr>2022-05-09 20:03:42 +0200
commit105b825923ce03fc43eacb0575212fe52336ce34 (patch)
tree109e0736a1b196f2d43f7ffcb8538e04bf20bcea /Static/Js
parent588c4ceb78fae443ca8f9446d256f5474a3bf66a (diff)
Mis en place du RGPD
Diffstat (limited to 'Static/Js')
-rw-r--r--Static/Js/googleAnalitycs.js11
-rw-r--r--Static/Js/rgpd.js19
2 files changed, 30 insertions, 0 deletions
diff --git a/Static/Js/googleAnalitycs.js b/Static/Js/googleAnalitycs.js
new file mode 100644
index 0000000..c67770f
--- /dev/null
+++ b/Static/Js/googleAnalitycs.js
@@ -0,0 +1,11 @@
+
+// ############################################################################
+// # #
+// # Description: Global site tag (gtag.js) - Google Analytics #
+// # #
+// ############################################################################
+
+window.dataLayer = window.dataLayer || [];
+function gtag(){dataLayer.push(arguments);}
+gtag('js', new Date());
+gtag('config', 'G-'); // G-XXXXXXXXXX -> Clef API à récupérer chez google
diff --git a/Static/Js/rgpd.js b/Static/Js/rgpd.js
new file mode 100644
index 0000000..a134717
--- /dev/null
+++ b/Static/Js/rgpd.js
@@ -0,0 +1,19 @@
+
+// ############################################################################
+// # #
+// # Description: JS uniquement utile dans l'index #
+// # #
+// ############################################################################
+
+// Bind du boutton Accepter et Supprimer pour les cookies de google analytics
+// L'option secure oblige le cookie à être transmis uniquement en https
+// Le max-age corrspond ici à un an, 60 sec x 60 min x 24H x 364 jours
+document.getElementById("rgpdAccept").addEventListener("click", () => {
+ document.cookie = "RGPD_ACCEPT=1; max-age=" + 60*60*24*364 + "; path=/; Secure;";
+ window.location.reload()
+});
+
+document.getElementById("rgpdDecline").addEventListener("click", () => {
+ document.cookie = "RGPD_ACCEPT=0; max-age=" + 60*60*24*364 + "; path=/; Secure;";
+ window.location.reload()
+}); \ No newline at end of file