From 014ed20eac8ec4df13b8fd258dae60831183eb1c Mon Sep 17 00:00:00 2001 From: Amauri CHAMPEAUX Date: Tue, 22 Mar 2022 17:02:14 +0100 Subject: [PATCH] Fix #890 --- tarteaucitron.services.js | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 85f9a3b..e2a279f 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -32,6 +32,55 @@ tarteaucitron.services.iframe = { } }; +tarteaucitron.services.piwikpro = { + "key": "piwikpro", + "type": "analytic", + "name": "Piwik Pro", + "uri": "https://piwik.pro/privacy-policy/", + "needConsent": true, + "cookies": ['_pk_ref', '_pk_cvar', '_pk_id', '_pk_ses', '_pk_hsr', 'piwik_ignore', '_pk_uid'], + "js": function () { + "use strict"; + if (tarteaucitron.user.tarteaucitron.user.piwikProId === undefined) { + return; + } + + window['dataLayer'] = window['dataLayer'] || [], window['dataLayer'].push({ + start: (new Date).getTime(), + event: "stg.start" + }); + + function stgCreateCookie(a, b, c) { + var d = ""; + if (c) { + var e = new Date; + e.setTime(e.getTime() + 24 * c * 60 * 60 * 1e3), d = "; expires=" + e.toUTCString() + } + document.cookie = a + "=" + b + d + "; path=/" + } + + var isStgDebug = (window.location.href.match("stg_debug") || document.cookie.match("stg_debug")) && !window.location.href.match("stg_disable_debug"); + stgCreateCookie("stg_debug", isStgDebug ? 1 : "", isStgDebug ? 14 : -1); + var qP = []; + + var qPString = qP.length > 0 ? ("?" + qP.join("&")) : ""; + tarteaucitron.addScript('https://carsatse.containers.piwik.pro/'+tarteaucitron.user.piwikProId+'.js'+qPString); + + ! function(a, n, i) { + a[n] = a[n] || {}; + for (var c = 0; c < i.length; c++) ! function(i) { + a[n][i] = a[n][i] || {}, a[n][i].api = a[n][i].api || function() { + var a = [].slice.call(arguments, 0); + "string" == typeof a[0] && window['dataLayer'].push({ + event: n + "." + i + ":" + a[0], + parameters: [].slice.call(arguments, 1) + }) + } + }(i[c]) + }(window, "ppms", ["tm", "cm"]); + } +}; + // pinterestpixel tarteaucitron.services.pinterestpixel = { "key": "pinterestpixel",