diff options
Diffstat (limited to 'Static/Js')
| -rw-r--r-- | Static/Js/googleAnalitycs.js | 11 | ||||
| -rw-r--r-- | Static/Js/rgpd.js | 19 |
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 |
