diff --git a/sites/all/modules/figli/edlp_agenda/src/Controller/AgendaController.php b/sites/all/modules/figli/edlp_agenda/src/Controller/AgendaController.php index 8b9ae5ca3..c6a19e5ab 100644 --- a/sites/all/modules/figli/edlp_agenda/src/Controller/AgendaController.php +++ b/sites/all/modules/figli/edlp_agenda/src/Controller/AgendaController.php @@ -79,7 +79,8 @@ class AgendaController extends ControllerBase { }); $data = [ - 'rendered'=> $rendered + 'rendered'=> $rendered, + 'title'=>'Agenda', ]; // translations links diff --git a/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js b/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js index 14915ab8a..07df41a8c 100644 --- a/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js +++ b/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js @@ -662,13 +662,20 @@ var $li = $link.parents('li'); var sys_path = $link.attr('data-drupal-link-system-path'); var url = $link.attr('href'); + var title = $link.text(); if(!$li.is('.opened')){ _$entrees_block_termlinks.parents('li').removeClass('opened'); $li.addClass('opened'); $li.parents('.item-list').addClass('opened') filterEntree(tid); if(bubbling){ - _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path}); + _$body.trigger({ + 'type':'open_entree', + 'tid':tid, + 'url':url, + 'sys_path':sys_path, + 'title':title + }); } // bubbling is true only when event is a real click on entree link }else if(bubbling){ @@ -800,6 +807,10 @@ _no_articles_nodes[i].fade(); } updateRandomPlaylist(_articles_nodes); + if(typeof _paq !== 'undefined'){ + // trackEvent(category, action, [name], [value]) + _paq.push(['trackEvent', 'Corpus Articles', 'on']); + } }; function deactivateArticlesFilter(){ //console.log('deactivateArticlesFilter'); @@ -808,6 +819,10 @@ _no_articles_nodes[i].unFade(); } updateRandomPlaylist(_playlist); + if(typeof _paq !== 'undefined'){ + // trackEvent(category, action, [name], [value]) + _paq.push(['trackEvent', 'Corpus Articles', 'off']); + } }; function shutDownArticles(){ // shutdown articles if active diff --git a/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js b/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js index 14915ab8a..07df41a8c 100644 --- a/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js +++ b/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js @@ -662,13 +662,20 @@ var $li = $link.parents('li'); var sys_path = $link.attr('data-drupal-link-system-path'); var url = $link.attr('href'); + var title = $link.text(); if(!$li.is('.opened')){ _$entrees_block_termlinks.parents('li').removeClass('opened'); $li.addClass('opened'); $li.parents('.item-list').addClass('opened') filterEntree(tid); if(bubbling){ - _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path}); + _$body.trigger({ + 'type':'open_entree', + 'tid':tid, + 'url':url, + 'sys_path':sys_path, + 'title':title + }); } // bubbling is true only when event is a real click on entree link }else if(bubbling){ @@ -800,6 +807,10 @@ _no_articles_nodes[i].fade(); } updateRandomPlaylist(_articles_nodes); + if(typeof _paq !== 'undefined'){ + // trackEvent(category, action, [name], [value]) + _paq.push(['trackEvent', 'Corpus Articles', 'on']); + } }; function deactivateArticlesFilter(){ //console.log('deactivateArticlesFilter'); @@ -808,6 +819,10 @@ _no_articles_nodes[i].unFade(); } updateRandomPlaylist(_playlist); + if(typeof _paq !== 'undefined'){ + // trackEvent(category, action, [name], [value]) + _paq.push(['trackEvent', 'Corpus Articles', 'off']); + } }; function shutDownArticles(){ // shutdown articles if active diff --git a/sites/all/modules/figli/edlp_productions/src/Controller/ProductionsController.php b/sites/all/modules/figli/edlp_productions/src/Controller/ProductionsController.php index 01191b4c5..82db0f144 100644 --- a/sites/all/modules/figli/edlp_productions/src/Controller/ProductionsController.php +++ b/sites/all/modules/figli/edlp_productions/src/Controller/ProductionsController.php @@ -102,6 +102,7 @@ class ProductionsController extends ControllerBase { $data = [ 'rendered'=> $rendered, + 'title'=> 'Productions', // 'block' => array( // 'rendered'=> \Drupal::service('renderer')->renderRoot($block_render), // 'region'=> str_replace('_', '-', $block->getRegion()), @@ -120,7 +121,7 @@ class ProductionsController extends ControllerBase { '#set_active_class' => TRUE, ]; $translations_rendered = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($translations_build) {return render($translations_build);}); - + $data ['translations_links'] = $translations_rendered; } diff --git a/sites/all/modules/figli/edlp_search/src/Controller/EdlpSearchController.php b/sites/all/modules/figli/edlp_search/src/Controller/EdlpSearchController.php index 4da6056e7..222969211 100644 --- a/sites/all/modules/figli/edlp_search/src/Controller/EdlpSearchController.php +++ b/sites/all/modules/figli/edlp_search/src/Controller/EdlpSearchController.php @@ -78,7 +78,8 @@ class EdlpSearchController extends ControllerBase { $rendered = render($this->renderable); $data = [ - 'rendered' => $rendered + 'rendered' => $rendered, + 'title' => 'Search', ]; // translations links diff --git a/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js b/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js index 2ce567593..a90279764 100644 --- a/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js +++ b/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js @@ -79,6 +79,18 @@ // }; var state = getSysPathState(e.sys_path); history.pushState(state, null, e.url); + + // piwik + if(typeof _paq !== 'undefined'){ + // page tracking + // https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/ + _paq.push(['setCustomUrl', e.url]); + _paq.push(['setDocumentTitle', e.title]); + _paq.push(['trackPageView']); + // js event + // trackEvent(category, action, [name], [value]) + // _paq.push(['trackEvent', 'AjaxNav', 'loaded', state.url]); + } } }) .on('close_entree', function(e){ diff --git a/sites/all/themes/custom/edlptheme/assets/scripts/main.js b/sites/all/themes/custom/edlptheme/assets/scripts/main.js index 2ce567593..a90279764 100644 --- a/sites/all/themes/custom/edlptheme/assets/scripts/main.js +++ b/sites/all/themes/custom/edlptheme/assets/scripts/main.js @@ -79,6 +79,18 @@ // }; var state = getSysPathState(e.sys_path); history.pushState(state, null, e.url); + + // piwik + if(typeof _paq !== 'undefined'){ + // page tracking + // https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/ + _paq.push(['setCustomUrl', e.url]); + _paq.push(['setDocumentTitle', e.title]); + _paq.push(['trackPageView']); + // js event + // trackEvent(category, action, [name], [value]) + // _paq.push(['trackEvent', 'AjaxNav', 'loaded', state.url]); + } } }) .on('close_entree', function(e){