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