added better page tracking for piwik
This commit is contained in:
@@ -25,12 +25,15 @@ class EdlpAjaxController extends ControllerBase {
|
||||
switch($this->entity_type){
|
||||
case 'node':
|
||||
$this->bundle = $this->entity->getType();
|
||||
$this->title = $this->entity->getTitle();
|
||||
break;
|
||||
case 'taxonomy_term':
|
||||
$this->bundle = $this->entity->bundle();
|
||||
$this->title = $this->entity->getName();
|
||||
break;
|
||||
default:
|
||||
$this->bundle = NULL;
|
||||
$this->title = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,10 +163,13 @@ class EdlpAjaxController extends ControllerBase {
|
||||
return render($renderable);
|
||||
});
|
||||
|
||||
$title = $this->title;
|
||||
$title .= $this->viewmode != '' && $this->viewmode != 'default' ? ' | ' . $this->viewmode : '';
|
||||
|
||||
$data = [
|
||||
'date' => time(),
|
||||
'id' => $this->id,
|
||||
'title' => $title,
|
||||
'view_mode' => $this->viewmode,
|
||||
'bundle' => $this->bundle,
|
||||
'entity_type' => $this->entity_type,
|
||||
|
||||
@@ -95,6 +95,12 @@
|
||||
|
||||
// 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', state.url]);
|
||||
// _paq.push(['setDocumentTitle', data.title]);
|
||||
// _paq.push(['trackPageView']);
|
||||
|
||||
// trackEvent(category, action, [name], [value])
|
||||
var search_name = 'keys:'+data.keys
|
||||
+';langues:'+data.langues
|
||||
|
||||
@@ -95,6 +95,12 @@
|
||||
|
||||
// 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', state.url]);
|
||||
// _paq.push(['setDocumentTitle', data.title]);
|
||||
// _paq.push(['trackPageView']);
|
||||
|
||||
// trackEvent(category, action, [name], [value])
|
||||
var search_name = 'keys:'+data.keys
|
||||
+';langues:'+data.langues
|
||||
|
||||
@@ -328,9 +328,9 @@ class EdlpSearchController extends ControllerBase {
|
||||
}
|
||||
|
||||
// entries
|
||||
$this->entry_names = [];
|
||||
if (!empty($this->entries)){
|
||||
$terms = entity_load_multiple('taxonomy_term', $this->entries);
|
||||
$this->entry_names = [];
|
||||
$entries_condition_group = $query->createConditionGroup();
|
||||
foreach ($terms as $tid => $term) {
|
||||
$entries_condition_group->addCondition('field_entrees', (int)$tid, "=");
|
||||
|
||||
@@ -302,6 +302,12 @@
|
||||
|
||||
// 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', state.url]);
|
||||
_paq.push(['setDocumentTitle', data.title]);
|
||||
_paq.push(['trackPageView']);
|
||||
// js event
|
||||
// trackEvent(category, action, [name], [value])
|
||||
_paq.push(['trackEvent', 'AjaxNav', 'loaded', state.url]);
|
||||
}
|
||||
|
||||
@@ -302,6 +302,12 @@
|
||||
|
||||
// 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', state.url]);
|
||||
_paq.push(['setDocumentTitle', data.title]);
|
||||
_paq.push(['trackPageView']);
|
||||
// js event
|
||||
// trackEvent(category, action, [name], [value])
|
||||
_paq.push(['trackEvent', 'AjaxNav', 'loaded', state.url]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user