From 3f59afef17cf22e4bd2a5eac1dd30bf91ccd2a0c Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 6 Apr 2017 15:52:29 +0300
Subject: [PATCH] Reduce meaningless Piwik stats (#953)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Don’t consider a request a search if it’s in lightbox or a facet list request.
---
 module/VuFind/src/VuFind/View/Helper/Root/Piwik.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php
index 45266fe9fc2..c628b764ffb 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php
@@ -244,10 +244,13 @@ class Piwik extends \Zend\View\Helper\AbstractHelper
     protected function getSearchResults()
     {
         $viewModel = $this->getView()->plugin('view_model');
+        if ('layout/lightbox' === $viewModel->getCurrent()->getTemplate()) {
+            return null;
+        }
         $children = $viewModel->getCurrent()->getChildren();
         if (isset($children[0])) {
             $template = $children[0]->getTemplate();
-            if (!strstr($template, '/home')) {
+            if (!strstr($template, '/home') && !strstr($template, 'facet-list')) {
                 $results = $children[0]->getVariable('results');
                 if (is_a($results, 'VuFind\Search\Base\Results')) {
                     return $results;
-- 
GitLab