Explorar el Código

Fix auto load of services when needconsent is true

+ add an alternative to not autoload matomo and at internet
Amauri CHAMPEAUX hace 5 años
padre
commit
4832682dde
Se han modificado 3 ficheros con 74 adiciones y 3 borrados
  1. BIN
      .DS_Store
  2. 1 1
      tarteaucitron.js
  3. 73 2
      tarteaucitron.services.js

BIN
.DS_Store


+ 1 - 1
tarteaucitron.js

@@ -560,7 +560,7 @@ var tarteaucitron = {
             isAutostart = (!service.needConsent),
             isAutostart = (!service.needConsent),
             isWaiting = (cookie.indexOf(service.key + '=wait') >= 0),
             isWaiting = (cookie.indexOf(service.key + '=wait') >= 0),
             isDenied = (cookie.indexOf(service.key + '=false') >= 0),
             isDenied = (cookie.indexOf(service.key + '=false') >= 0),
-            isAllowed = ((cookie.indexOf(service.key + '=true') >= 0) || (!service.needConsent)),
+            isAllowed = ((cookie.indexOf(service.key + '=true') >= 0) || (!service.needConsent && cookie.indexOf(service.key + '=false') < 0)),
             isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0),
             isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0),
             isDNTRequested = (navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1" || window.doNotTrack === "1");
             isDNTRequested = (navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1" || window.doNotTrack === "1");
 
 

+ 73 - 2
tarteaucitron.services.js

@@ -2367,7 +2367,7 @@ tarteaucitron.services.xiti = {
 tarteaucitron.services.atinternet = {
 tarteaucitron.services.atinternet = {
     "key": "atinternet",
     "key": "atinternet",
     "type": "analytic",
     "type": "analytic",
-    "name": "AT Internet",
+    "name": "AT Internet (privacy by design)",
     "uri": "https://www.atinternet.com/societe/rgpd-et-vie-privee/",
     "uri": "https://www.atinternet.com/societe/rgpd-et-vie-privee/",
     "needConsent": false,
     "needConsent": false,
     "cookies": ['atidvisitor', 'atreman', 'atredir', 'atsession', 'atuserid'],
     "cookies": ['atidvisitor', 'atreman', 'atredir', 'atsession', 'atuserid'],
@@ -2388,6 +2388,31 @@ tarteaucitron.services.atinternet = {
     }
     }
 };
 };
 
 
+// AT Internet
+tarteaucitron.services.atinternethightrack = {
+    "key": "atinternethightrack",
+    "type": "analytic",
+    "name": "AT Internet",
+    "uri": "https://www.atinternet.com/societe/rgpd-et-vie-privee/",
+    "needConsent": true,
+    "cookies": ['atidvisitor', 'atreman', 'atredir', 'atsession', 'atuserid'],
+    "js": function () {
+        "use strict";
+        if (tarteaucitron.user.atLibUrl === undefined) {
+            return;
+        }
+
+        tarteaucitron.addScript(tarteaucitron.user.atLibUrl, '', function() {
+
+            var tag = new ATInternet.Tracker.Tag();
+
+            if (typeof tarteaucitron.user.atMore === 'function') {
+                tarteaucitron.user.atMore();
+            }
+        })
+    }
+};
+
 // youtube
 // youtube
 tarteaucitron.services.youtube = {
 tarteaucitron.services.youtube = {
     "key": "youtube",
     "key": "youtube",
@@ -2702,7 +2727,7 @@ tarteaucitron.services.koban = {
 tarteaucitron.services.matomo = {
 tarteaucitron.services.matomo = {
     "key": "matomo",
     "key": "matomo",
     "type": "analytic",
     "type": "analytic",
-    "name": "Matomo (formerly known as Piwik)",
+    "name": "Matomo (privacy by design)",
     "uri": "https://matomo.org/faq/general/faq_146/",
     "uri": "https://matomo.org/faq/general/faq_146/",
     "needConsent": false,
     "needConsent": false,
     "cookies": ['_pk_ref', '_pk_cvar', '_pk_id', '_pk_ses', '_pk_hsr', 'piwik_ignore', '_pk_uid'],
     "cookies": ['_pk_ref', '_pk_cvar', '_pk_id', '_pk_ses', '_pk_hsr', 'piwik_ignore', '_pk_uid'],
@@ -2758,6 +2783,52 @@ tarteaucitron.services.matomo = {
         }, 100)
         }, 100)
     }
     }
 };
 };
+                          
+                          
+tarteaucitron.services.matomohightrack = {
+    "key": "matomohightrack",
+    "type": "analytic",
+    "name": "Matomo",
+    "uri": "https://matomo.org/faq/general/faq_146/",
+    "needConsent": true,
+    "cookies": ['_pk_ref', '_pk_cvar', '_pk_id', '_pk_ses', '_pk_hsr', 'piwik_ignore', '_pk_uid'],
+    "js": function () {
+        "use strict";
+        if (tarteaucitron.user.matomoId === undefined) {
+            return;
+        }
+
+        window._paq = window._paq || [];
+        window._paq.push(["setSiteId", tarteaucitron.user.matomoId]);
+        window._paq.push(["setTrackerUrl", tarteaucitron.user.matomoHost + "piwik.php"]);
+        window._paq.push(["trackPageView"]);
+        window._paq.push(["setIgnoreClasses", ["no-tracking", "colorbox"]]);
+        window._paq.push(["enableLinkTracking"]);
+        window._paq.push([function() {
+            var self = this;
+        }]);
+
+        tarteaucitron.addScript(tarteaucitron.user.matomoHost + 'piwik.js', '', '', true, 'defer', true);
+
+        // waiting for piwik to be ready to check first party cookies
+        var interval = setInterval(function() {
+            if (typeof Piwik === 'undefined') return
+
+            clearInterval(interval)
+            Piwik.getTracker();
+
+            var theCookies = document.cookie.split(';');
+            for (var i = 1 ; i <= theCookies.length; i++) {
+                var cookie = theCookies[i-1].split('=');
+                var cookieName = cookie[0].trim();
+
+                if (cookieName.indexOf('_pk_') === 0) {
+                    tarteaucitron.services.matomo.cookies.push(cookieName);
+                }
+            }
+        }, 100)
+    }
+};
 
 
 // Hotjar
 // Hotjar
  /*
  /*