Verified Commit 9163a923 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

change piwik to matomo

parent 09699422
......@@ -98,7 +98,7 @@
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>
<script>
/* Piwik global variable */
/* Matomo global variable */
var _paq = window._paq || _paq || [];
var settings = [];
settings.expires = 180;
......@@ -121,7 +121,7 @@ function getCookie(cname) {
return "";
}
function loadPiwik() {
function loadMatomo() {
var u = settings.matomoURL;
_paq.push(['setSiteId', settings.siteID]);
_paq.push(['setTrackerUrl', u + 'matomo.php']);
......@@ -147,7 +147,7 @@ function hidelapCookieBanner() {
popup.hide();
console.log('removed the banner');
}
function clearPiwik() {
function clearMatomo() {
var cookies = document.cookie.split('; ');
for (var i in cookies) {
var name = cookies[i].split('=')[0];
......@@ -172,14 +172,14 @@ $( document ).ready(function() {
jQuery('.lap-cookies-accept').addClass('disabled');
jQuery('.lap-cookies-refuse').removeClass('disabled');
jQuery(this).blur();
loadPiwik();
loadMatomo();
});
/* refuse */
$('.lap-cookies-refuse').click(function (e) {
e.preventDefault(true);
console.log('clicked on refuse');
clearPiwik();
clearMatomo();
Cookies.set('lap_cookie_agree', 0, { expires: parseInt(settings.expires), path: '/' });
hidelapCookieBanner();
//jQuery('#lap-cookies-banner').slideUp('slow');
......@@ -202,14 +202,14 @@ $( document ).ready(function() {
lapCookieAgree = getCookie('lap_cookie_agree');
console.log(lapCookieAgree);
if (lapCookieAgree == '0') {
/* Visitor refused our cookies => remove piwik trace if present */
/* Visitor refused our cookies => remove Matomo trace if present */
jQuery('.lap-cookies-refuse').addClass('disabled');
clearPiwik();
clearMatomo();
}
else if (lapCookieAgree == '1') {
/* Visitor accepted our cookies => load Piwik */
/* Visitor accepted our cookies => load Matomo */
jQuery('.lap-cookies-accept').addClass('disabled');
loadPiwik();
loadMatomo();
}
else {
/* Visitor did not choose yet */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment