improved path detection for matomo, added filters behaviours matomo event
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+20
-9
@@ -28,15 +28,6 @@ var Layout = {
|
|||||||
// console.log('Layout view : lang', vn.attrs.lang);
|
// console.log('Layout view : lang', vn.attrs.lang);
|
||||||
_i18n.setLang(vn.attrs.lang);
|
_i18n.setLang(vn.attrs.lang);
|
||||||
console.log('Layout view : path', m.route.get());
|
console.log('Layout view : path', m.route.get());
|
||||||
// matomo
|
|
||||||
// https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/
|
|
||||||
if(typeof _paq !== 'undefined'){
|
|
||||||
_paq.push(['setCustomUrl', m.route.get()]);
|
|
||||||
// _paq.push(['setDocumentTitle', e.title]);
|
|
||||||
_paq.push(['setGenerationTimeMs', 0]);
|
|
||||||
_paq.push(['trackPageView']);
|
|
||||||
// _paq.push(['trackEvent', 'Audio', 'play', node.title]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
m(_Header, vn.attrs),
|
m(_Header, vn.attrs),
|
||||||
@@ -57,12 +48,32 @@ function init(){
|
|||||||
m.route.prefix("");
|
m.route.prefix("");
|
||||||
m.route(document.body, "/fr/connections", {
|
m.route(document.body, "/fr/connections", {
|
||||||
"/:lang/text": {
|
"/:lang/text": {
|
||||||
|
onmatch(args, requestedPath){
|
||||||
|
// matomo
|
||||||
|
if(typeof _paq !== 'undefined'){
|
||||||
|
// console.log('new path ',requestedPath);
|
||||||
|
_paq.push(['setCustomUrl', requestedPath]);
|
||||||
|
// _paq.push(['setDocumentTitle', e.title]);
|
||||||
|
_paq.push(['setGenerationTimeMs', 0]);
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
}
|
||||||
|
},
|
||||||
render(vn){
|
render(vn){
|
||||||
// console.log('Routing render : vn', vn);
|
// console.log('Routing render : vn', vn);
|
||||||
return m(Layout, vn.attrs, m(_ModeText, vn.attrs));
|
return m(Layout, vn.attrs, m(_ModeText, vn.attrs));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/:lang/connections": {
|
"/:lang/connections": {
|
||||||
|
onmatch(args, requestedPath){
|
||||||
|
// matomo
|
||||||
|
if(typeof _paq !== 'undefined'){
|
||||||
|
// console.log('new path ',requestedPath);
|
||||||
|
_paq.push(['setCustomUrl', requestedPath]);
|
||||||
|
// _paq.push(['setDocumentTitle', e.title]);
|
||||||
|
_paq.push(['setGenerationTimeMs', 0]);
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
}
|
||||||
|
},
|
||||||
render(vn){
|
render(vn){
|
||||||
return m(Layout, vn.attrs, m(_ModeConnections, vn.attrs));
|
return m(Layout, vn.attrs, m(_ModeConnections, vn.attrs));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ var _Filters = {
|
|||||||
// activate the filter
|
// activate the filter
|
||||||
let type = e.target.getAttribute("type");
|
let type = e.target.getAttribute("type");
|
||||||
_dbs.active_type_filter = type;
|
_dbs.active_type_filter = type;
|
||||||
|
// matomo
|
||||||
|
if(typeof _paq !== 'undefined'){
|
||||||
|
// console.log('Matomo Connection closed', vn.state.breadcrumb);
|
||||||
|
_paq.push(['trackEvent', 'Filter', 'opened', type]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user