Revue intégration Matomo
This commit is contained in:
parent
4f409167ba
commit
d6c0f7db3a
7
config/matomo.js
Normal file
7
config/matomo.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Si non utilisé, supprimer l'appel des JS front-end puis recompiler.
|
||||||
|
// Revoir comment réorganiser cela sous-forme de module indépendant.
|
||||||
|
module.exports =
|
||||||
|
{
|
||||||
|
// Stats Matomo :
|
||||||
|
matomo: { url: "https://stats.le-fab-lab.com/", siteId: "5" },
|
||||||
|
};
|
@ -18,6 +18,7 @@ import { addElement } from "./tools/dom.js";
|
|||||||
import { helloDev } from "./tools/everywhere.js";
|
import { helloDev } from "./tools/everywhere.js";
|
||||||
import { getDatasFromInputs } from "./tools/forms.js";
|
import { getDatasFromInputs } from "./tools/forms.js";
|
||||||
import { isEmpty } from "../../tools/main";
|
import { isEmpty } from "../../tools/main";
|
||||||
|
import { loadMatomo } from "./tools/matomo.js";
|
||||||
import { checkAnswerDatas, checkSession, getTimeDifference, setSession } from "./tools/users.js";
|
import { checkAnswerDatas, checkSession, getTimeDifference, setSession } from "./tools/users.js";
|
||||||
|
|
||||||
// Dictionnaires :
|
// Dictionnaires :
|
||||||
@ -47,6 +48,7 @@ const initialise = async () =>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
loadMatomo();
|
||||||
myForm.style.display="block";
|
myForm.style.display="block";
|
||||||
if(!isEmpty(getLocaly("message")))
|
if(!isEmpty(getLocaly("message")))
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ const configFrontEnd = require("../../views/"+theme+"/config/"+lang+".js");
|
|||||||
import { getLocaly, removeLocaly, saveLocaly } from "./tools/clientstorage.js";
|
import { getLocaly, removeLocaly, saveLocaly } from "./tools/clientstorage.js";
|
||||||
import { addElement } from "./tools/dom.js";
|
import { addElement } from "./tools/dom.js";
|
||||||
import { helloDev } from "./tools/everywhere.js";
|
import { helloDev } from "./tools/everywhere.js";
|
||||||
|
import { loadMatomo } from "./tools/matomo.js";
|
||||||
import { getUrlParams } from "./tools/url.js";
|
import { getUrlParams } from "./tools/url.js";
|
||||||
import { checkSession, getConfig, setSession } from "./tools/users.js";
|
import { checkSession, getConfig, setSession } from "./tools/users.js";
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ const initialise = async () =>
|
|||||||
if(!config)
|
if(!config)
|
||||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const datas=getUrlParams();
|
const datas=getUrlParams();
|
||||||
if(datas && datas.t!==undefined)
|
if(datas && datas.t!==undefined)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
|
|||||||
|
|
||||||
import { getLocaly } from "./tools/clientstorage.js";
|
import { getLocaly } from "./tools/clientstorage.js";
|
||||||
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||||
|
import { loadMatomo } from "./tools/matomo.js";
|
||||||
import { checkSession } from "./tools/users.js";
|
import { checkSession } from "./tools/users.js";
|
||||||
|
|
||||||
helloDev();
|
helloDev();
|
||||||
@ -25,36 +26,7 @@ const initialise = async () =>
|
|||||||
updateAccountLink(user.status, configTemplate);
|
updateAccountLink(user.status, configTemplate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
loadMatomo();
|
||||||
// chargement de matomo
|
|
||||||
var _paq = window._paq = window._paq || [];
|
|
||||||
//ajout cnil :
|
|
||||||
_paq.push([function()
|
|
||||||
{
|
|
||||||
var self = this;
|
|
||||||
function getOriginalVisitorCookieTimeout()
|
|
||||||
{
|
|
||||||
var now = new Date(),
|
|
||||||
nowTs = Math.round(now.getTime() / 1000),
|
|
||||||
visitorInfo = self.getVisitorInfo();
|
|
||||||
var createTs = parseInt(visitorInfo[2]);
|
|
||||||
var cookieTimeout = 33696000; // 13 mois en secondes
|
|
||||||
var originalTimeout = createTs + cookieTimeout - nowTs;
|
|
||||||
return originalTimeout;
|
|
||||||
}
|
|
||||||
this.setVisitorCookieTimeout( getOriginalVisitorCookieTimeout() );
|
|
||||||
}]);
|
|
||||||
//--fin ajout cnil
|
|
||||||
_paq.push(['trackPageView']);
|
|
||||||
_paq.push(['enableLinkTracking']);
|
|
||||||
(function() {
|
|
||||||
var u="https://stats.le-fab-lab.com/";
|
|
||||||
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
|
||||||
_paq.push(['setSiteId', '5']);
|
|
||||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
||||||
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(e)
|
catch(e)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
|||||||
import { getLocaly } from "./tools/clientstorage.js";
|
import { getLocaly } from "./tools/clientstorage.js";
|
||||||
import { getDatasFromInputs } from "./tools/forms.js";
|
import { getDatasFromInputs } from "./tools/forms.js";
|
||||||
import { dateFormat, replaceAll } from "../../tools/main";
|
import { dateFormat, replaceAll } from "../../tools/main";
|
||||||
|
import { loadMatomo } from "./tools/matomo.js";
|
||||||
import { checkSession, getTimeDifference } from "./tools/users.js";
|
import { checkSession, getTimeDifference } from "./tools/users.js";
|
||||||
|
|
||||||
// Dictionnaires :
|
// Dictionnaires :
|
||||||
@ -45,6 +46,8 @@ const initialise = async () =>
|
|||||||
updateAccountLink(user.status, configTemplate);// lien vers le compte adapté pour les utilisateurs connectés
|
updateAccountLink(user.status, configTemplate);// lien vers le compte adapté pour les utilisateurs connectés
|
||||||
checkPreviousResponses(user);
|
checkPreviousResponses(user);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
loadMatomo();
|
||||||
}
|
}
|
||||||
catch(e)
|
catch(e)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ import { getLocaly, removeLocaly, saveLocaly } from "./tools/clientstorage.js";
|
|||||||
import { addElement } from "./tools/dom.js";
|
import { addElement } from "./tools/dom.js";
|
||||||
import { helloDev } from "./tools/everywhere.js";
|
import { helloDev } from "./tools/everywhere.js";
|
||||||
import { getDatasFromInputs, setAttributesToInputs } from "./tools/forms.js";
|
import { getDatasFromInputs, setAttributesToInputs } from "./tools/forms.js";
|
||||||
|
import { loadMatomo } from "./tools/matomo.js";
|
||||||
import { checkAnswerDatas, checkSession, getPassword, getTimeDifference } from "./tools/users.js";
|
import { checkAnswerDatas, checkSession, getPassword, getTimeDifference } from "./tools/users.js";
|
||||||
|
|
||||||
// Dictionnaires :
|
// Dictionnaires :
|
||||||
@ -49,6 +50,7 @@ const initialise = async () =>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
loadMatomo();
|
||||||
setAttributesToInputs(configUsers, myForm);
|
setAttributesToInputs(configUsers, myForm);
|
||||||
myForm.style.display="block";
|
myForm.style.display="block";
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
|
|||||||
import { getLocaly, saveLocaly } from "./tools/clientstorage.js";
|
import { getLocaly, saveLocaly } from "./tools/clientstorage.js";
|
||||||
import { addElement } from "./tools/dom.js";
|
import { addElement } from "./tools/dom.js";
|
||||||
import { helloDev } from "./tools/everywhere.js";
|
import { helloDev } from "./tools/everywhere.js";
|
||||||
|
import { loadMatomo } from "./tools/matomo.js";
|
||||||
import { getUrlParams } from "./tools/url.js";
|
import { getUrlParams } from "./tools/url.js";
|
||||||
import { checkSession } from "./tools/users.js";
|
import { checkSession } from "./tools/users.js";
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ const initialise = async () =>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
loadMatomo();
|
||||||
const datas=getUrlParams();
|
const datas=getUrlParams();
|
||||||
if(datas && datas.t!==undefined)
|
if(datas && datas.t!==undefined)
|
||||||
{
|
{
|
||||||
|
34
front/src/tools/matomo.js
Normal file
34
front/src/tools/matomo.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { matomo } from "../../../config/matomo.js";
|
||||||
|
|
||||||
|
// Fonction chargeant le code matomo
|
||||||
|
export const loadMatomo = () =>
|
||||||
|
{
|
||||||
|
// chargement de matomo
|
||||||
|
var _paq = window._paq = window._paq || [];
|
||||||
|
//ajout cnil :
|
||||||
|
_paq.push([function()
|
||||||
|
{
|
||||||
|
var self = this;
|
||||||
|
function getOriginalVisitorCookieTimeout()
|
||||||
|
{
|
||||||
|
var now = new Date(),
|
||||||
|
nowTs = Math.round(now.getTime() / 1000),
|
||||||
|
visitorInfo = self.getVisitorInfo();
|
||||||
|
var createTs = parseInt(visitorInfo[2]);
|
||||||
|
var cookieTimeout = 33696000; // 13 mois en secondes
|
||||||
|
var originalTimeout = createTs + cookieTimeout - nowTs;
|
||||||
|
return originalTimeout;
|
||||||
|
}
|
||||||
|
this.setVisitorCookieTimeout( getOriginalVisitorCookieTimeout() );
|
||||||
|
}]);
|
||||||
|
//--fin ajout cnil
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
_paq.push(['enableLinkTracking']);
|
||||||
|
(function() {
|
||||||
|
var u=matomo.url;
|
||||||
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||||
|
_paq.push(['setSiteId', matomo.siteId]);
|
||||||
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||||
|
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
|
})();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user