Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/DataTable/Renderer/Csv.php32
-rw-r--r--plugins/CoreHome/CoreHome.php1
-rw-r--r--plugins/CoreHome/angularjs/common/filters/ucfirst.js21
-rw-r--r--plugins/CustomVariables/API.php56
-rw-r--r--plugins/CustomVariables/Archiver.php35
-rw-r--r--plugins/CustomVariables/Controller.php13
-rw-r--r--plugins/CustomVariables/CustomVariables.php33
-rw-r--r--plugins/CustomVariables/Menu.php33
-rw-r--r--plugins/CustomVariables/Model.php44
-rw-r--r--plugins/CustomVariables/Tracker/CustomVariablesRequestProcessor.php4
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js35
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html41
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.js26
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less10
-rw-r--r--plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js36
-rw-r--r--plugins/CustomVariables/lang/en.json12
-rw-r--r--plugins/CustomVariables/templates/manage.twig11
-rw-r--r--plugins/CustomVariables/tests/Integration/ModelTest.php2
-rw-r--r--plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml96
-rw-r--r--plugins/CustomVariables/tests/UI/.gitignore2
-rw-r--r--plugins/CustomVariables/tests/UI/CustomVariables_spec.js31
-rw-r--r--plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.pngbin0 -> 19928 bytes
-rw-r--r--plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_link_in_menu.pngbin0 -> 5143 bytes
-rw-r--r--plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.pngbin0 -> 44125 bytes
-rw-r--r--tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml24
-rw-r--r--tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml48
-rw-r--r--tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml113
-rw-r--r--tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml63
-rw-r--r--tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml63
-rw-r--r--tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml42
-rw-r--r--tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml30
-rw-r--r--tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml24
-rw-r--r--tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml12
-rwxr-xr-xtests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml42
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml63
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml63
-rw-r--r--tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml46
-rw-r--r--tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml46
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml12
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml12
-rw-r--r--tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml64
-rw-r--r--tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml64
-rw-r--r--tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml46
-rw-r--r--tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml46
-rw-r--r--tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml40
-rw-r--r--tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml40
-rw-r--r--tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php35
47 files changed, 1583 insertions, 29 deletions
diff --git a/core/DataTable/Renderer/Csv.php b/core/DataTable/Renderer/Csv.php
index 4eee1949b7..c3fb08b15a 100644
--- a/core/DataTable/Renderer/Csv.php
+++ b/core/DataTable/Renderer/Csv.php
@@ -70,6 +70,8 @@ class Csv extends Renderer
*/
const NO_DATA_AVAILABLE = 'No data available';
+ private $unsupportedColumns = array();
+
/**
* Computes the dataTable output and returns the string/binary
*
@@ -213,6 +215,12 @@ class Csv extends Renderer
*/
private function getHeaderLine($columnMetrics)
{
+ foreach ($columnMetrics as $index => $value) {
+ if (in_array($value, $this->unsupportedColumns)) {
+ unset($columnMetrics[$index]);
+ }
+ }
+
if ($this->translateColumnNames) {
$columnMetrics = $this->translateColumnNames($columnMetrics);
}
@@ -391,12 +399,23 @@ class Csv extends Renderer
$name = 'metadata_' . $name;
}
- $csvRow[$name] = $value;
+ if (is_array($value)) {
+ if (!in_array($name, $this->unsupportedColumns)) {
+ $this->unsupportedColumns[] = $name;
+ }
+ } else {
+ $csvRow[$name] = $value;
+ }
+
}
}
foreach ($csvRow as $name => $value) {
- $allColumns[$name] = true;
+ if (in_array($name, $this->unsupportedColumns)) {
+ unset($allColumns[$name]);
+ } else {
+ $allColumns[$name] = true;
+ }
}
if ($this->exportIdSubtable) {
@@ -410,6 +429,15 @@ class Csv extends Renderer
$csv[] = $csvRow;
}
+
+ if (!empty($this->unsupportedColumns)) {
+ foreach ($this->unsupportedColumns as $unsupportedColumn) {
+ foreach ($csv as $index => $row) {
+ unset($row[$index][$unsupportedColumn]);
+ }
+ }
+ }
+
return $csv;
}
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php
index f2d788cd54..7cf82cfd3b 100644
--- a/plugins/CoreHome/CoreHome.php
+++ b/plugins/CoreHome/CoreHome.php
@@ -134,6 +134,7 @@ class CoreHome extends \Piwik\Plugin
$jsFiles[] = "plugins/CoreHome/angularjs/common/filters/trim.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/filters/pretty-url.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/filters/htmldecode.js";
+ $jsFiles[] = "plugins/CoreHome/angularjs/common/filters/ucfirst.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/directive.module.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js";
diff --git a/plugins/CoreHome/angularjs/common/filters/ucfirst.js b/plugins/CoreHome/angularjs/common/filters/ucfirst.js
new file mode 100644
index 0000000000..34b3460be8
--- /dev/null
+++ b/plugins/CoreHome/angularjs/common/filters/ucfirst.js
@@ -0,0 +1,21 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+(function () {
+ angular.module('piwikApp.filter').filter('ucfirst', ucfirst);
+
+ function ucfirst() {
+
+ return function(value) {
+ if (!value) {
+ return value;
+ }
+
+ var firstLetter = (value + '').charAt(0).toUpperCase();
+ return firstLetter + value.substr(1);
+ };
+ }
+})();
diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php
index fa3a99dbca..57832927e5 100644
--- a/plugins/CustomVariables/API.php
+++ b/plugins/CustomVariables/API.php
@@ -8,10 +8,12 @@
*/
namespace Piwik\Plugins\CustomVariables;
+use Piwik\API\Request;
use Piwik\Archive;
use Piwik\DataTable;
use Piwik\Date;
use Piwik\Metrics;
+use Piwik\Piwik;
use Piwik\Plugins\Actions\Actions\ActionSiteSearch;
/**
@@ -71,6 +73,7 @@ class API extends \Piwik\Plugin\API
}
}
+
if ($flat) {
$dataTable->filterSubtables('Piwik\Plugins\CustomVariables\DataTable\Filter\CustomVariablesValuesFromNameId');
} else {
@@ -109,9 +112,62 @@ class API extends \Piwik\Plugin\API
// Hack Ecommerce product price tracking to display correctly
$dataTable->renameColumn('price_viewed', 'price');
}
+
$dataTable->filter('Piwik\Plugins\CustomVariables\DataTable\Filter\CustomVariablesValuesFromNameId');
return $dataTable;
}
+
+ /**
+ * Get a list of all available custom variable slots (scope + index) and which names have been used so far in
+ * each slot since the beginning of the website.
+ *
+ * @param int $idSite
+ * @return array
+ */
+ public function getUsagesOfSlots($idSite)
+ {
+ Piwik::checkUserHasAdminAccess($idSite);
+
+ $numVars = CustomVariables::getNumUsableCustomVariables();
+
+ $usedCustomVariables = array(
+ 'visit' => array_fill(1, $numVars, array()),
+ 'page' => array_fill(1, $numVars, array()),
+ );
+
+ /** @var DataTable $customVarUsages */
+ $customVarUsages = Request::processRequest('CustomVariables.getCustomVariables',
+ array('idSite' => $idSite, 'period' => 'range', 'date' => '2008-12-12,today',
+ 'format' => 'original', 'serialize' => '0')
+ );
+
+ foreach ($customVarUsages->getRows() as $row) {
+ $slots = $row->getMetadata('slots');
+
+ if (!empty($slots)) {
+ foreach ($slots as $slot) {
+ $usedCustomVariables[$slot['scope']][$slot['index']][] = array(
+ 'name' => $row->getColumn('label'),
+ 'nb_visits' => $row->getColumn('nb_visits'),
+ 'nb_actions' => $row->getColumn('nb_actions'),
+ );
+ }
+ }
+ }
+
+ $grouped = array();
+ foreach ($usedCustomVariables as $scope => $scopes) {
+ foreach ($scopes as $index => $cvars) {
+ $grouped[] = array(
+ 'scope' => $scope,
+ 'index' => $index,
+ 'usages' => $cvars
+ );
+ }
+ }
+
+ return $grouped;
+ }
}
diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php
index bc43cbc8dd..4a53ab78df 100644
--- a/plugins/CustomVariables/Archiver.php
+++ b/plugins/CustomVariables/Archiver.php
@@ -8,7 +8,6 @@
*/
namespace Piwik\Plugins\CustomVariables;
-use Piwik\Common;
use Piwik\Config;
use Piwik\DataAccess\LogAggregator;
use Piwik\DataArray;
@@ -35,6 +34,9 @@ class Archiver extends \Piwik\Plugin\Archiver
protected $maximumRowsInSubDataTable;
protected $newEmptyRow;
+ private $metadata = array();
+ private $metadataFlat = array();
+
function __construct($processor)
{
parent::__construct($processor);
@@ -74,6 +76,16 @@ class Archiver extends \Piwik\Plugin\Archiver
$this->removeVisitsMetricsFromActionsAggregate();
$this->dataArray->enrichMetricsWithConversions();
$table = $this->dataArray->asDataTable();
+
+ foreach ($table->getRows() as $row) {
+ $label = $row->getColumn('label');
+ if (!empty($this->metadata[$label])) {
+ foreach ($this->metadata[$label] as $name => $value) {
+ $row->addMetadata($name, $value);
+ }
+ }
+ }
+
$blob = $table->getSerialized(
$this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable,
$columnToSort = Metrics::INDEX_NB_VISITS
@@ -118,6 +130,8 @@ class Archiver extends \Piwik\Plugin\Archiver
$key = $row[$keyField];
$value = $this->cleanCustomVarValue($row[$valueField]);
+ $this->addMetadata($keyField, $key, Model::SCOPE_VISIT);
+
$this->dataArray->sumMetricsVisits($key, $row);
$this->dataArray->sumMetricsVisitsPivot($key, $value, $row);
}
@@ -137,6 +151,8 @@ class Archiver extends \Piwik\Plugin\Archiver
$key = $row[$keyField];
$value = $this->cleanCustomVarValue($row[$valueField]);
+ $this->addMetadata($keyField, $key, Model::SCOPE_PAGE);
+
$alreadyAggregated = $this->aggregateEcommerceCategories($key, $value, $row);
if (!$alreadyAggregated) {
$this->aggregateActionByKeyAndValue($key, $value, $row);
@@ -145,6 +161,22 @@ class Archiver extends \Piwik\Plugin\Archiver
}
}
+ private function addMetadata($keyField, $label, $scope)
+ {
+ $index = (int) str_replace('custom_var_k', '', $keyField);
+
+ if (!array_key_exists($label, $this->metadata)) {
+ $this->metadata[$label] = array('slots' => array());
+ }
+
+ $uniqueId = $label . 'scope' . $scope . 'index' . $index;
+
+ if (!isset($this->metadataFlat[$uniqueId])) {
+ $this->metadata[$label]['slots'][] = array('scope' => $scope, 'index' => $index);
+ $this->metadataFlat[$uniqueId] = true;
+ }
+ }
+
/**
* @param string $key
* @param string $value
@@ -205,6 +237,7 @@ class Archiver extends \Piwik\Plugin\Archiver
}
while ($row = $query->fetch()) {
$key = $row[$keyField];
+
$value = $this->cleanCustomVarValue($row[$valueField]);
$this->dataArray->sumMetricsGoals($key, $row);
$this->dataArray->sumMetricsGoalsPivot($key, $value, $row);
diff --git a/plugins/CustomVariables/Controller.php b/plugins/CustomVariables/Controller.php
index 59a4a949de..e73e58b257 100644
--- a/plugins/CustomVariables/Controller.php
+++ b/plugins/CustomVariables/Controller.php
@@ -8,7 +8,20 @@
*/
namespace Piwik\Plugins\CustomVariables;
+use Piwik\Common;
+use Piwik\DataTable;
+use Piwik\Piwik;
+
class Controller extends \Piwik\Plugin\Controller
{
+ public function manage()
+ {
+ $idSite = Common::getRequestVar('idSite');
+
+ Piwik::checkUserHasAdminAccess($idSite);
+
+ return $this->renderTemplate('manage', array());
+ }
+
}
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index b8a57ad6a6..03238212f1 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -22,7 +22,10 @@ class CustomVariables extends \Piwik\Plugin
{
return array(
'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata',
- 'Live.getAllVisitorDetails' => 'extendVisitorDetails'
+ 'Live.getAllVisitorDetails' => 'extendVisitorDetails',
+ 'AssetManager.getJavaScriptFiles' => 'getJsFiles',
+ 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
+ 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
);
}
@@ -144,4 +147,32 @@ class CustomVariables extends \Piwik\Plugin
}
}
+ public function getClientSideTranslationKeys(&$translationKeys)
+ {
+ $translationKeys[] = 'CustomVariables_CustomVariables';
+ $translationKeys[] = 'CustomVariables_ManageDescription';
+ $translationKeys[] = 'CustomVariables_Scope';
+ $translationKeys[] = 'CustomVariables_Index';
+ $translationKeys[] = 'CustomVariables_Usages';
+ $translationKeys[] = 'CustomVariables_Unused';
+ $translationKeys[] = 'CustomVariables_CreateNewSlot';
+ $translationKeys[] = 'CustomVariables_UsageDetails';
+ $translationKeys[] = 'CustomVariables_CurrentAvailableCustomVariables';
+ $translationKeys[] = 'CustomVariables_ToCreateCustomVarExecute';
+ $translationKeys[] = 'CustomVariables_CreatingCustomVariableTakesTime';
+ $translationKeys[] = 'General_Loading';
+ }
+
+ public function getStylesheetFiles(&$stylesheets)
+ {
+ $stylesheets[] = "plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less";
+ }
+
+ public function getJsFiles(&$jsFiles)
+ {
+ $jsFiles[] = "plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js";
+ $jsFiles[] = "plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js";
+ $jsFiles[] = "plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.js";
+ }
+
}
diff --git a/plugins/CustomVariables/Menu.php b/plugins/CustomVariables/Menu.php
new file mode 100644
index 0000000000..80e1d78193
--- /dev/null
+++ b/plugins/CustomVariables/Menu.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Plugins\CustomVariables;
+
+use Piwik\Common;
+use Piwik\Menu\MenuUser;
+use Piwik\Piwik;
+use Piwik\Plugins\UsersManager\UserPreferences;
+
+/**
+ * This class allows you to add, remove or rename menu items.
+ * To configure a menu (such as Admin Menu, Reporting Menu, User Menu...) simply call the corresponding methods as
+ * described in the API-Reference http://developer.piwik.org/api-reference/Piwik/Menu/MenuAbstract
+ */
+class Menu extends \Piwik\Plugin\Menu
+{
+ public function configureUserMenu(MenuUser $menu)
+ {
+ $userPreferences = new UserPreferences();
+ $default = $userPreferences->getDefaultWebsiteId();
+ $idSite = Common::getRequestVar('idSite', $default, 'int');
+
+ if (Piwik::isUserHasAdminAccess($idSite)) {
+ $menu->addManageItem('Custom Variables', $this->urlForAction('manage'), $orderId = 30);
+ }
+ }
+}
diff --git a/plugins/CustomVariables/Model.php b/plugins/CustomVariables/Model.php
index 9d98a352fa..235809e1da 100644
--- a/plugins/CustomVariables/Model.php
+++ b/plugins/CustomVariables/Model.php
@@ -15,12 +15,14 @@ use Piwik\Log;
class Model
{
- const SCOPE_PAGE = 'log_link_visit_action';
- const SCOPE_VISIT = 'log_visit';
- const SCOPE_CONVERSION = 'log_conversion';
const DEFAULT_CUSTOM_VAR_COUNT = 5;
+ const SCOPE_PAGE = 'page';
+ const SCOPE_VISIT = 'visit';
+ const SCOPE_CONVERSION = 'conversion';
+
private $scope = null;
+ private $table = null;
public function __construct($scope)
{
@@ -29,21 +31,27 @@ class Model
}
$this->scope = $scope;
+ $this->table = Common::prefixTable($this->getTableNameFromScope($scope));
}
- public function getScopeName()
+ private function getTableNameFromScope($scope)
{
// actually we should have a class for each scope but don't want to overengineer it for now
- switch ($this->scope) {
+ switch ($scope) {
case self::SCOPE_PAGE:
- return 'Page';
+ return 'log_link_visit_action';
case self::SCOPE_VISIT:
- return 'Visit';
+ return 'log_visit';
case self::SCOPE_CONVERSION:
- return 'Conversion';
+ return 'log_conversion';
}
}
+ public function getScopeName()
+ {
+ return ucfirst($this->scope);
+ }
+
/**
* @see getHighestCustomVarIndex()
* @return int
@@ -96,8 +104,7 @@ class Model
private function getCustomVarColumnNames()
{
- $dbTable = $this->getDbTableName();
- $columns = Db::getColumnNamesFromTable($dbTable);
+ $columns = Db::getColumnNamesFromTable($this->table);
$customVarColumns = array_filter($columns, function ($column) {
return false !== strpos($column, 'custom_var_');
@@ -108,14 +115,13 @@ class Model
public function removeCustomVariable()
{
- $dbTable = $this->getDbTableName();
- $index = $this->getHighestCustomVarIndex();
+ $index = $this->getHighestCustomVarIndex();
if ($index < 1) {
return null;
}
- Db::exec(sprintf('ALTER TABLE %s ', $dbTable)
+ Db::exec(sprintf('ALTER TABLE %s ', $this->table)
. sprintf('DROP COLUMN custom_var_k%d,', $index)
. sprintf('DROP COLUMN custom_var_v%d;', $index));
@@ -124,22 +130,16 @@ class Model
public function addCustomVariable()
{
- $dbTable = $this->getDbTableName();
- $index = $this->getHighestCustomVarIndex() + 1;
- $maxLen = CustomVariables::getMaxLengthCustomVariables();
+ $index = $this->getHighestCustomVarIndex() + 1;
+ $maxLen = CustomVariables::getMaxLengthCustomVariables();
- Db::exec(sprintf('ALTER TABLE %s ', $dbTable)
+ Db::exec(sprintf('ALTER TABLE %s ', $this->table)
. sprintf('ADD COLUMN custom_var_k%d VARCHAR(%d) DEFAULT NULL,', $index, $maxLen)
. sprintf('ADD COLUMN custom_var_v%d VARCHAR(%d) DEFAULT NULL;', $index, $maxLen));
return $index;
}
- private function getDbTableName()
- {
- return Common::prefixTable($this->scope);
- }
-
public static function getCustomVariableIndexFromFieldName($fieldName)
{
$onlyNumber = str_replace(array('custom_var_k', 'custom_var_v'), '', $fieldName);
diff --git a/plugins/CustomVariables/Tracker/CustomVariablesRequestProcessor.php b/plugins/CustomVariables/Tracker/CustomVariablesRequestProcessor.php
index 44e6d59350..720aca8431 100644
--- a/plugins/CustomVariables/Tracker/CustomVariablesRequestProcessor.php
+++ b/plugins/CustomVariables/Tracker/CustomVariablesRequestProcessor.php
@@ -9,6 +9,8 @@
namespace Piwik\Plugins\CustomVariables\Tracker;
use Piwik\Common;
+use Piwik\Plugins\CustomVariables\CustomVariables;
+use Piwik\Plugins\CustomVariables\Model;
use Piwik\Tracker\Request;
use Piwik\Tracker\RequestProcessor;
use Piwik\Tracker\Visit\VisitProperties;
@@ -36,7 +38,7 @@ class CustomVariablesRequestProcessor extends RequestProcessor
public function processRequestParams(VisitProperties $visitProperties, Request $request)
{
// TODO: re-add optimization where if custom variables exist in request, don't bother selecting them in Visitor
- $visitorCustomVariables = $request->getCustomVariables($scope = 'visit');
+ $visitorCustomVariables = $request->getCustomVariables($scope = Model::SCOPE_VISIT);
if (!empty($visitorCustomVariables)) {
Common::printDebug("Visit level Custom Variables: ");
Common::printDebug($visitorCustomVariables);
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js
new file mode 100644
index 0000000000..4b6b1c213d
--- /dev/null
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js
@@ -0,0 +1,35 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+(function () {
+ angular.module('piwikApp').controller('ManageCustomVarsController', ManageCustomVarsController);
+
+ ManageCustomVarsController.$inject = ['manageCustomVarsModel', 'piwik', '$filter'];
+
+ function ManageCustomVarsController(manageCustomVarsModel, piwik, $filter) {
+ manageCustomVarsModel.fetchUsages();
+
+ this.model = manageCustomVarsModel;
+ this.createCustomVariableSlot = function () {
+ var highestIndex = 5;
+ angular.forEach(manageCustomVarsModel.customVariables, function (customVar) {
+ if (customVar.index > highestIndex) {
+ highestIndex = customVar.index;
+ }
+ });
+
+ var translate = $filter('translate');
+
+ var command = './console customvariables:set-max-custom-variables ' + (highestIndex + 1);
+ var text = translate('CustomVariables_CreatingCustomVariableTakesTime');
+ text += '<br /><br />' + translate('CustomVariables_CurrentAvailableCustomVariables', '<strong>' + highestIndex + '</strong>');
+ text += '<br /><br />' + translate('CustomVariables_ToCreateCustomVarExecute');
+ text += '<br /><br /><code>' + command + '</code>';
+
+ piwik.helper.modalConfirm('<div class="ui-confirm" title="' + translate('CustomVariables_CreateNewSlot') + '">' + text + '<br /><br /></div>');
+ }
+ }
+})(); \ No newline at end of file
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html
new file mode 100644
index 0000000000..8cc7c60e60
--- /dev/null
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html
@@ -0,0 +1,41 @@
+<div class="manageCustomVars">
+ <h2 piwik-enriched-headline>{{ 'CustomVariables_CustomVariables'|translate }}</h2>
+
+ {{ 'CustomVariables_ManageDescription'|translate }}
+
+ <br />
+
+ <h3>{{ customVariables.scope }}</h3>
+ <table class="dataTable entityTable" style="max-width: 900px;">
+ <thead>
+ <tr>
+ <th>{{'CustomVariables_Scope'|translate }}</th>
+ <th>{{'CustomVariables_Index'|translate }}</th>
+ <th>{{'CustomVariables_Usages'|translate }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="3" ng-show="manageCustomVars.model.isLoading">{{ 'General_Loading'|translate }}</td>
+ </tr>
+ <tr ng-repeat="customVariables in manageCustomVars.model.customVariables">
+ <td class="scope">{{ customVariables.scope|ucfirst }}</td>
+ <td class="index">{{ customVariables.index }}</td>
+ <td>
+ <span ng-show="(customVariables.usages|length) === 0"
+ class="unused">{{'CustomVariables_Unused'|translate }}</span>
+ <span ng-show="customVariables.usages|length" ng-repeat="cvar in customVariables.usages|orderBy:'-nb_actions'">
+ <span title="{{ 'CustomVariables_UsageDetails'|translate:cvar.nb_visits:cvar.nb_actions }}">{{ cvar.name }}</span><span ng-show="!$last">, </span>
+ </span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <br/>
+ <a class="btn addCustomVar" ng-show="!manageCustomVars.model.isLoading" value=""
+ ng-click="manageCustomVars.createCustomVariableSlot()"
+ >{{ 'CustomVariables_CreateNewSlot'|translate }} <span class="icon-info"></span></a><br/>
+
+
+</div> \ No newline at end of file
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.js b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.js
new file mode 100644
index 0000000000..1623d50b27
--- /dev/null
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.js
@@ -0,0 +1,26 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+/**
+ * Usage:
+ * <div piwik-manage-custom-vars>
+ */
+(function () {
+ angular.module('piwikApp').directive('piwikManageCustomVars', piwikManageCustomVars);
+
+ piwikManageCustomVars.$inject = ['piwik'];
+
+ function piwikManageCustomVars(piwik){
+ return {
+ restrict: 'A',
+ scope: {},
+ templateUrl: 'plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html?cb=' + piwik.cacheBuster,
+ controller: 'ManageCustomVarsController',
+ controllerAs: 'manageCustomVars'
+ };
+ }
+})(); \ No newline at end of file
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less
new file mode 100644
index 0000000000..2d3e4e4f04
--- /dev/null
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less
@@ -0,0 +1,10 @@
+.manageCustomVars {
+ .unused {
+ color: @color-silver;
+ }
+
+ .scope, .index {
+ width: 90px;
+ max-width: 90px;
+ }
+} \ No newline at end of file
diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js
new file mode 100644
index 0000000000..3cc5b3d4b2
--- /dev/null
+++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js
@@ -0,0 +1,36 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+(function () {
+ angular.module('piwikApp').factory('manageCustomVarsModel', manageCustomVarsModel);
+
+ manageCustomVarsModel.$inject = ['piwikApi'];
+
+ function manageCustomVarsModel(piwikApi) {
+
+ var model = {
+ customVariables : [],
+ extractions : [],
+ isLoading: false,
+ fetchUsages: fetchUsages
+ };
+
+ return model;
+
+ function fetchUsages() {
+
+ model.isLoading = true;
+
+ piwikApi.fetch({method: 'CustomVariables.getUsagesOfSlots'})
+ .then(function (customVariables) {
+ model.customVariables = customVariables;
+ })['finally'](function () { // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c
+ model.isLoading = false;
+ });
+ }
+
+ }
+})(); \ No newline at end of file
diff --git a/plugins/CustomVariables/lang/en.json b/plugins/CustomVariables/lang/en.json
index 7d99f97bf2..61033b2757 100644
--- a/plugins/CustomVariables/lang/en.json
+++ b/plugins/CustomVariables/lang/en.json
@@ -6,6 +6,16 @@
"CustomVariablesReportDocumentation": "This report contains information about your Custom Variables. Click on a variable name to see the distribution of the values. %s For more information about Custom Variables in general, read the %sCustom Variables documentation on piwik.org%s",
"PluginDescription": "Custom Variables are (name, value) pairs that you can assign using the Javascript API to visitors or any of their action. Piwik will then report how many visits, pages, conversions for each of these custom names and values. View the detailed Custom Variables for each user and action in the Visitor Log.<br />Required to use <a href=\"http://piwik.org/docs/ecommerce-analytics/\">Ecommerce Analytics</a> feature!",
"ScopePage": "scope page",
- "ScopeVisit": "scope visit"
+ "ScopeVisit": "scope visit",
+ "ManageDescription": "This overview shows all custom variable slots and their usages. The names within each slot are ordered by how often they were used in total.",
+ "Scope": "Scope",
+ "Index": "Index",
+ "Usages": "Usages",
+ "Unused": "Unused",
+ "CreateNewSlot": "Create a new Custom Variable slot",
+ "UsageDetails": "%s visits and %s actions since creation of this website.",
+ "CreatingCustomVariableTakesTime": "Creating a new custom variable slot can take a long time depending on the size of your database. Therefore it is only possible to do this via a command which needs to be executed on the command line.",
+ "CurrentAvailableCustomVariables": "Currently you can use up to %s Custom Variables per site.",
+ "ToCreateCustomVarExecute": "To create a new custom variable slot execute the following command within your Piwik installation: "
}
} \ No newline at end of file
diff --git a/plugins/CustomVariables/templates/manage.twig b/plugins/CustomVariables/templates/manage.twig
new file mode 100644
index 0000000000..fa7a085aa9
--- /dev/null
+++ b/plugins/CustomVariables/templates/manage.twig
@@ -0,0 +1,11 @@
+{% extends 'user.twig' %}
+
+{% block topcontrols %}
+ <div class="top_bar_sites_selector piwikTopControl">
+ <div piwik-siteselector class="sites_autocomplete"></div>
+ </div>
+{% endblock %}
+
+{% block content %}
+ <div piwik-manage-custom-vars>
+{% endblock %} \ No newline at end of file
diff --git a/plugins/CustomVariables/tests/Integration/ModelTest.php b/plugins/CustomVariables/tests/Integration/ModelTest.php
index 128e5b09ef..905a5f6a1d 100644
--- a/plugins/CustomVariables/tests/Integration/ModelTest.php
+++ b/plugins/CustomVariables/tests/Integration/ModelTest.php
@@ -19,7 +19,7 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
*/
class ModelTest extends IntegrationTestCase
{
- private static $cvarScopes = array('log_link_visit_action', 'log_visit', 'log_conversion');
+ private static $cvarScopes = array('page', 'visit', 'conversion');
public function setUp()
{
diff --git a/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml b/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml
index 3a5683bdc6..054f9b1e31 100644
--- a/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml
+++ b/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml
@@ -3,6 +3,12 @@
<row>
<label>Name_PAGE_1</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_1</segment>
<subtable>
<row>
@@ -15,6 +21,12 @@
<row>
<label>Name_PAGE_2</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_2</segment>
<subtable>
<row>
@@ -27,6 +39,12 @@
<row>
<label>Name_PAGE_3</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_3</segment>
<subtable>
<row>
@@ -39,6 +57,12 @@
<row>
<label>Name_PAGE_4</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_4</segment>
<subtable>
<row>
@@ -51,6 +75,12 @@
<row>
<label>Name_PAGE_5</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_5</segment>
<subtable>
<row>
@@ -63,6 +93,12 @@
<row>
<label>Name_PAGE_6</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>6</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_6</segment>
<subtable>
<row>
@@ -75,6 +111,12 @@
<row>
<label>Name_PAGE_7</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>7</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_7</segment>
<subtable>
<row>
@@ -87,6 +129,12 @@
<row>
<label>Name_PAGE_8</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>8</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_PAGE_8</segment>
<subtable>
<row>
@@ -113,6 +161,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_1</segment>
<subtable>
<row>
@@ -152,6 +206,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_2</segment>
<subtable>
<row>
@@ -191,6 +251,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_3</segment>
<subtable>
<row>
@@ -230,6 +296,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_4</segment>
<subtable>
<row>
@@ -269,6 +341,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_5</segment>
<subtable>
<row>
@@ -308,6 +386,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>6</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_6</segment>
<subtable>
<row>
@@ -347,6 +431,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>7</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_7</segment>
<subtable>
<row>
@@ -386,6 +476,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>8</index>
+ </row>
+ </slots>
<segment>customVariableName==Name_VISIT_8</segment>
<subtable>
<row>
diff --git a/plugins/CustomVariables/tests/UI/.gitignore b/plugins/CustomVariables/tests/UI/.gitignore
new file mode 100644
index 0000000000..f39be478e7
--- /dev/null
+++ b/plugins/CustomVariables/tests/UI/.gitignore
@@ -0,0 +1,2 @@
+/processed-ui-screenshots
+/screenshot-diffs \ No newline at end of file
diff --git a/plugins/CustomVariables/tests/UI/CustomVariables_spec.js b/plugins/CustomVariables/tests/UI/CustomVariables_spec.js
new file mode 100644
index 0000000000..a64a1cd7ce
--- /dev/null
+++ b/plugins/CustomVariables/tests/UI/CustomVariables_spec.js
@@ -0,0 +1,31 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot integration tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("CustomVariables", function () {
+ this.timeout(0);
+
+ this.fixture = "Piwik\\Plugins\\CustomVariables\\tests\\Fixtures\\VisitWithManyCustomVariables";
+
+ it('should show an overview of all used custom variables', function (done) {
+ expect.screenshot('manage').to.be.captureSelector('.pageWrap', function (page) {
+ page.load("?idSite=1&period=day&date=2010-01-03&module=CustomVariables&action=manage");
+ }, done);
+ });
+
+ it('should be visible in the menu', function (done) {
+ expect.screenshot('link_in_menu').to.be.captureSelector('li:contains(Manage)', function (page) {
+ }, done);
+ });
+
+ it('should show custom variable creation command in dialog', function (done) {
+ expect.screenshot('create').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('.manageCustomVars .addCustomVar')
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png
new file mode 100644
index 0000000000..ccd46cfa9b
--- /dev/null
+++ b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png
Binary files differ
diff --git a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_link_in_menu.png b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_link_in_menu.png
new file mode 100644
index 0000000000..95e1c7783d
--- /dev/null
+++ b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_link_in_menu.png
Binary files differ
diff --git a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png
new file mode 100644
index 0000000000..c520cde1bf
--- /dev/null
+++ b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png
Binary files differ
diff --git a/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml
index c8cd332705..cb25516ca4 100644
--- a/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml
@@ -4,6 +4,12 @@
<row>
<label>CustomVarPage</label>
<nb_actions>18</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<is_aggregate>1</is_aggregate>
</row>
<row>
@@ -15,6 +21,12 @@
<sum_visit_length>6</sum_visit_length>
<bounce_count>0</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<is_aggregate>1</is_aggregate>
</row>
<row>
@@ -68,6 +80,12 @@
<sum_visit_length>1</sum_visit_length>
<bounce_count>0</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<is_aggregate>1</is_aggregate>
</row>
<row>
@@ -84,6 +102,12 @@
<row>
<label>CustomVarPage</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<is_aggregate>1</is_aggregate>
</row>
<row>
diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml
index dc1a11ab2b..a1fea85a41 100644
--- a/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml
+++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml
@@ -3,6 +3,12 @@
<row>
<label>HTTP-code</label>
<nb_actions>43</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==HTTP-code</segment>
<subtable>
<row>
@@ -61,6 +67,12 @@
<revenue>25</revenue>
<sum_daily_nb_uniq_visitors>7</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Not-Bot</segment>
<subtable>
<row>
@@ -151,6 +163,12 @@
<revenue>10</revenue>
<sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>1</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==User+Name</segment>
<subtable>
<row>
@@ -196,6 +214,12 @@
<row>
<label>Generation Time</label>
<nb_actions>4</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Generation+Time</segment>
<subtable>
<row>
@@ -221,6 +245,12 @@
<row>
<label>Windows Status Code</label>
<nb_actions>4</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Windows+Status+Code</segment>
<subtable>
<row>
@@ -267,6 +297,12 @@
<revenue>5</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Bot</segment>
<subtable>
<row>
@@ -308,6 +344,12 @@
<revenue>5</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Forum+status</segment>
<subtable>
<row>
@@ -349,6 +391,12 @@
<revenue>5</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml
new file mode 100644
index 0000000000..002b96ca46
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ <usages>
+ <row>
+ <name>Domain landed</name>
+ <nb_visits>12</nb_visits>
+ <nb_actions>16</nb_actions>
+ </row>
+ <row>
+ <name>Not-Bot</name>
+ <nb_visits>7</nb_visits>
+ <nb_actions>10</nb_actions>
+ </row>
+ <row>
+ <name>User Name</name>
+ <nb_visits>3</nb_visits>
+ <nb_actions>5</nb_actions>
+ </row>
+ <row>
+ <name>Bot</name>
+ <nb_visits>1</nb_visits>
+ <nb_actions>1</nb_actions>
+ </row>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ <usages>
+ <row>
+ <name>Demo language</name>
+ <nb_visits>1</nb_visits>
+ <nb_actions>1</nb_actions>
+ </row>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ <usages>
+ <row>
+ <name>Forum status</name>
+ <nb_visits>1</nb_visits>
+ <nb_actions>1</nb_actions>
+ </row>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ <usages>
+ <row>
+ <name>VisitorType</name>
+ <nb_visits>1</nb_visits>
+ <nb_actions>1</nb_actions>
+ </row>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ <usages>
+ <row>
+ <name>HTTP-code</name>
+ <nb_visits>0</nb_visits>
+ <nb_actions>69</nb_actions>
+ </row>
+ <row>
+ <name>Generation Time</name>
+ <nb_visits>0</nb_visits>
+ <nb_actions>4</nb_actions>
+ </row>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ <usages>
+ <row>
+ <name>Windows Status Code</name>
+ <nb_visits>0</nb_visits>
+ <nb_actions>4</nb_actions>
+ </row>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml
new file mode 100644
index 0000000000..81163427e5
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml
new file mode 100644
index 0000000000..81163427e5
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml
index 9a056e8786..5b6b0bc255 100644
--- a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml
@@ -6,6 +6,12 @@
<label>_pk_scount</label>
<nb_visits>4</nb_visits>
<nb_actions>6</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<subtable>
<row>
@@ -24,6 +30,12 @@
<label>_pk_scat</label>
<nb_visits>2</nb_visits>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<subtable>
<row>
@@ -39,6 +51,12 @@
<label>_pk_scount</label>
<nb_visits>3</nb_visits>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<subtable>
<row>
@@ -62,6 +80,12 @@
<label>_pk_scat</label>
<nb_visits>2</nb_visits>
<nb_actions>2</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<subtable>
<row>
@@ -89,6 +113,12 @@
<label>_pk_scount</label>
<nb_visits>1</nb_visits>
<nb_actions>2</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<subtable>
<row>
@@ -102,6 +132,12 @@
<label>_pk_scat</label>
<nb_visits>1</nb_visits>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<subtable>
<row>
@@ -130,6 +166,12 @@
<sum_visit_length>541</sum_visit_length>
<bounce_count>0</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==test+cvar+name</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml
index 50b6b4821e..76eae7c657 100644
--- a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml
+++ b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml
@@ -7,6 +7,12 @@
<nb_visits>7</nb_visits>
<nb_actions>9</nb_actions>
<sum_daily_nb_uniq_visitors>7</sum_daily_nb_uniq_visitors>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<subtable>
<row>
@@ -34,6 +40,12 @@
<nb_visits>4</nb_visits>
<nb_actions>5</nb_actions>
<sum_daily_nb_uniq_visitors>4</sum_daily_nb_uniq_visitors>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<subtable>
<row>
@@ -71,6 +83,12 @@
<nb_visits>1</nb_visits>
<nb_actions>2</nb_actions>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<subtable>
<row>
@@ -86,6 +104,12 @@
<nb_visits>1</nb_visits>
<nb_actions>1</nb_actions>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<subtable>
<row>
@@ -116,6 +140,12 @@
<nb_visits_converted>0</nb_visits_converted>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==test+cvar+name</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml
index 96a5e2ca93..04b14932b5 100644
--- a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml
+++ b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml
@@ -111,11 +111,23 @@
<reportMetadata>
<result prettyDate="Sunday, January 3, 2010">
<row>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<idsubdatatable>3173</idsubdatatable>
</row>
<row>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<idsubdatatable>3172</idsubdatatable>
@@ -123,11 +135,23 @@
</result>
<result prettyDate="Monday, January 4, 2010">
<row>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<idsubdatatable>3176</idsubdatatable>
</row>
<row>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<idsubdatatable>3175</idsubdatatable>
diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml
index 84acfed862..0d9935f4ed 100644
--- a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml
+++ b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml
@@ -80,11 +80,23 @@
<reportMetadata>
<result prettyDate="January 2010">
<row>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scount</segment>
<idsubdatatable>3198</idsubdatatable>
</row>
<row>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pk_scat</segment>
<idsubdatatable>3197</idsubdatatable>
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml
index 1d0ee64c8d..caf12153e5 100755
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml
@@ -33,6 +33,12 @@
</goals>
<nb_conversions>3</nb_conversions>
<revenue>3121.11</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==ValueIsZero</segment>
<subtable>
<row>
@@ -104,6 +110,12 @@
</goals>
<nb_conversions>3</nb_conversions>
<revenue>3121.11</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -146,6 +158,12 @@
<label>_pkc</label>
<nb_visits>7</nb_visits>
<nb_actions>12</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==_pkc</segment>
<subtable>
<row>
@@ -191,6 +209,12 @@
<label>_pkn</label>
<nb_visits>6</nb_visits>
<nb_actions>11</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==_pkn</segment>
<subtable>
<row>
@@ -216,6 +240,12 @@
<label>_pks</label>
<nb_visits>6</nb_visits>
<nb_actions>11</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==_pks</segment>
<subtable>
<row>
@@ -265,6 +295,12 @@
</goals>
<nb_conversions>2</nb_conversions>
<revenue>3111.11</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorName</segment>
<subtable>
<row>
@@ -302,6 +338,12 @@
<label>_pkp</label>
<nb_visits>8</nb_visits>
<nb_actions>8</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==_pkp</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml
new file mode 100644
index 0000000000..81163427e5
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml
new file mode 100644
index 0000000000..81163427e5
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>visit</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ <usages>
+ </usages>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ <usages>
+ </usages>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml
index 00acc7d7d0..8851c23d9a 100644
--- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml
+++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml
@@ -23,6 +23,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -88,6 +94,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -114,6 +126,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -148,6 +170,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -189,6 +217,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment>
<subtable>
<row>
@@ -215,6 +249,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -228,6 +268,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml
index 00acc7d7d0..8851c23d9a 100644
--- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml
+++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml
@@ -23,6 +23,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -88,6 +94,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -114,6 +126,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -148,6 +170,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -189,6 +217,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment>
<subtable>
<row>
@@ -215,6 +249,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -228,6 +268,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml
index 6b7a4a8b1c..c1ba006247 100644
--- a/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml
@@ -3,6 +3,12 @@
<row>
<label>liked</label>
<nb_actions>20</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==liked</segment>
<subtable>
<row>
@@ -20,6 +26,12 @@
<row>
<label>tweeted</label>
<nb_actions>20</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==tweeted</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml
index 6b7a4a8b1c..c1ba006247 100644
--- a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml
@@ -3,6 +3,12 @@
<row>
<label>liked</label>
<nb_actions>20</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==liked</segment>
<subtable>
<row>
@@ -20,6 +26,12 @@
<row>
<label>tweeted</label>
<nb_actions>20</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==tweeted</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml
index ebbd07023b..7ffb6725e4 100644
--- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml
@@ -24,6 +24,12 @@
</goals>
<nb_conversions>3</nb_conversions>
<revenue>1000</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -86,6 +92,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -125,6 +137,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -150,6 +168,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -181,6 +209,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>1000</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment>
<subtable>
<row>
@@ -206,6 +240,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -218,6 +258,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
@@ -230,6 +276,12 @@
<row>
<label>var1</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==var1</segment>
<subtable>
<row>
@@ -242,6 +294,12 @@
<row>
<label>var2</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==var2</segment>
<subtable>
<row>
@@ -254,6 +312,12 @@
<row>
<label>var3</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==var3</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml
index 92a4a5c7be..0514b1d5d3 100644
--- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml
+++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml
@@ -25,6 +25,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -90,6 +96,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -131,6 +143,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -157,6 +175,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -191,6 +219,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment>
<subtable>
<row>
@@ -217,6 +251,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -230,6 +270,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
@@ -243,6 +289,12 @@
<row>
<label>var1</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==var1</segment>
<subtable>
<row>
@@ -256,6 +308,12 @@
<row>
<label>var2</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==var2</segment>
<subtable>
<row>
@@ -269,6 +327,12 @@
<row>
<label>var3</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ </slots>
<segment>customVariableName==var3</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml
index 7e941dea10..1bfb23612e 100644
--- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml
@@ -24,6 +24,12 @@
</goals>
<nb_conversions>3</nb_conversions>
<revenue>1000</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -86,6 +92,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -111,6 +123,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -142,6 +164,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -181,6 +209,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>1000</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment>
<subtable>
<row>
@@ -206,6 +240,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -218,6 +258,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml
index 54f91c076f..4041ca8eac 100644
--- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml
+++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml
@@ -25,6 +25,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -90,6 +96,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -116,6 +128,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -150,6 +172,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -191,6 +219,12 @@
<revenue>1000</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment>
<subtable>
<row>
@@ -217,6 +251,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -230,6 +270,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml
index 304bb2fe65..428f0180ae 100644
--- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml
+++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml
@@ -19,6 +19,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -44,6 +50,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -75,6 +91,12 @@
</goals>
<nb_conversions>1</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -119,6 +141,12 @@
</goals>
<nb_conversions>2</nb_conversions>
<revenue>0</revenue>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -157,6 +185,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -169,6 +203,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml
index c4f92b8e6b..4c0da8f95e 100644
--- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml
+++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml
@@ -20,6 +20,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE</segment>
<subtable>
<row>
@@ -46,6 +52,16 @@
<row>
<label>Status user</label>
<nb_actions>3</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>4</index>
+ </row>
+ <row>
+ <scope>page</scope>
+ <index>5</index>
+ </row>
+ </slots>
<segment>customVariableName==Status+user</segment>
<subtable>
<row>
@@ -80,6 +96,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>3</index>
+ </row>
+ </slots>
<segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment>
<subtable>
<row>
@@ -126,6 +148,12 @@
<revenue>0</revenue>
<sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
+ <slots>
+ <row>
+ <scope>visit</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==VisitorType</segment>
<subtable>
<row>
@@ -165,6 +193,12 @@
<row>
<label>Language</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>1</index>
+ </row>
+ </slots>
<segment>customVariableName==Language</segment>
<subtable>
<row>
@@ -178,6 +212,12 @@
<row>
<label>SET WITH EMPTY VALUE PAGE SCOPE</label>
<nb_actions>1</nb_actions>
+ <slots>
+ <row>
+ <scope>page</scope>
+ <index>2</index>
+ </row>
+ </slots>
<segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment>
<subtable>
<row>
diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php
index c6fd94e406..057f500d18 100644
--- a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php
@@ -96,6 +96,22 @@ class DataTable_Renderer_CSVTest extends \PHPUnit_Framework_TestCase
return $table;
}
+ protected function _getDataTableHavingAnArrayInRowMetadata()
+ {
+ $array = array(
+ array(Row::COLUMNS => array('label' => 'sub1', 'count' => 1)),
+ array(Row::COLUMNS => array('label' => 'sub2', 'count' => 2), Row::METADATA => array('test' => 'render')),
+ array(Row::COLUMNS => array('label' => 'sub3', 'count' => 2), Row::METADATA => array('test' => 'renderMe', 'testArray' => 'ignore')),
+ array(Row::COLUMNS => array('label' => 'sub4', 'count' => 6), Row::METADATA => array('testArray' => array('do not render'))),
+ array(Row::COLUMNS => array('label' => 'sub5', 'count' => 2), Row::METADATA => array('testArray' => 'do ignore', 'mymeta' => 'should be rendered')),
+ array(Row::COLUMNS => array('label' => 'sub6', 'count' => 3), Row::METADATA => array('mymeta' => 'renderrrrrr')),
+ );
+
+ $table = new DataTable();
+ $table->addRowsFromArray($array);
+
+ return $table;
+ }
public function testCSVTest1()
{
@@ -186,6 +202,25 @@ class DataTable_Renderer_CSVTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
+ public function testCSVTest7_shouldNotRenderMetadataThatContainsAnArray()
+ {
+ $dataTable = $this->_getDataTableHavingAnArrayInRowMetadata();
+ $render = new Csv();
+ $render->setTable($dataTable);
+ $render->convertToUnicode = false;
+
+ // the column "testArray" should be ignored and not rendered, all other columns should be assigned correctly
+ $expected = "label,count,metadata_test,metadata_mymeta
+sub1,1,,
+sub2,2,render,
+sub3,2,renderMe,
+sub4,6,,
+sub5,2,,should be rendered
+sub6,3,,renderrrrrr";
+ $rendered = $render->render();
+ $this->assertEquals($expected, $rendered);
+ }
+
/**
* DATA OF DATATABLE_ARRAY
* -------------------------