From 8367ba5bb9e8a343ce39fe3c477640cff36c0f85 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Wed, 8 Oct 2014 11:59:43 +0300
Subject: [PATCH] Added a template check so that we don't record home page as a
 site search.

---
 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 2acbb1d7707..0893b4335cc 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php
@@ -105,7 +105,10 @@ class Piwik extends \Zend\View\Helper\AbstractHelper
         $viewModel = $view->plugin('view_model');
         $children = $viewModel->getCurrent()->getChildren();
         if (isset($children[0])) {
-            $results = $children[0]->getVariable('results');
+            $template = $children[0]->getTemplate();
+            if (!strstr($template, '/home')) {
+                $results = $children[0]->getVariable('results');
+            }
             $recordDriver = $children[0]->getVariable('driver');
         }
         if ($results && is_a($results, 'VuFind\Search\Base\Results')) {
-- 
GitLab