From 1c917ed62b0aaa31e70fa576bf45e4b5d88b19e4 Mon Sep 17 00:00:00 2001 From: Ricci Dorian Date: Thu, 5 Jul 2018 10:33:59 +0200 Subject: [PATCH 1/2] Added matomo service without merge conflict --- tarteaucitron.services.js | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 03e1955..9ddf7fe 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -2200,3 +2200,44 @@ tarteaucitron.services.multiplegtag = { } }; +// matomo + +/* + 1. Set the following variable before the initialization : + + tarteaucitron.user.matomoId = YOUR_SITE_ID_FROM_MATOMO; + tarteaucitron.user.matomoHost = "YOUR_MATOMO_URL"; //eg: https://stat.mydomain.com/ + + 2. Push the service : + + (tarteaucitron.job = tarteaucitron.job || []).push('matomo'); + + 3. HTML + You don't need to add any html code, if the service is autorized, the javascript is added. otherwise no. + */ +tarteaucitron.services.matomo = { + "key": "matomo", + "type": "analytic", + "name": "Matomo (formerly known as Piwik)", + "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"; + console.log("matomo"); + 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(["setDoNotTrack", 1]); + window._paq.push(["trackPageView"]); + window._paq.push(["setIgnoreClasses", ["no-tracking", "colorbox"]]); + window._paq.push(["enableLinkTracking"]); + + tarteaucitron.addScript(tarteaucitron.user.matomoHost + 'piwik.js', '', '', true, 'defer', true); + } +}; + From 8168f29e12cf6cc76379cd116d8781a5888146e8 Mon Sep 17 00:00:00 2001 From: Ricci Dorian Date: Sat, 7 Jul 2018 12:04:31 +0200 Subject: [PATCH 2/2] removed console.log --- tarteaucitron.services.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 9ddf7fe..ea1eba1 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -2224,7 +2224,6 @@ tarteaucitron.services.matomo = { "cookies": ['_pk_ref', '_pk_cvar', '_pk_id', '_pk_ses', '_pk_hsr', 'piwik_ignore', '_pk_uid'], "js": function () { "use strict"; - console.log("matomo"); if (tarteaucitron.user.matomoId === undefined) { return; }