diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-06-09 11:58:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 11:58:32 +0300 |
commit | 8e25f1c68ab44fb0795b34f3459eabf362976f61 (patch) | |
tree | db4ad5c8474c73fbd1420d734be5cafbe15c5a9b /plugins/CustomVariables | |
parent | bc626e6a3676f075f0b71d3534107da4d504ec44 (diff) |
Track ecommerce views as new dimensions instead of custom variables (#15999)
* Adds new columns to log_link_visit_action table to track ecommerce view data
* update piwik.js to track ecommerce view s the new way
* Adjust archiving
* update tests
* [TEMP] use php-tracker branch for composer
* Archive custom variables the old way, only if Matomo was installed before 4.0
* add fallback to custom variables to keep bc when replaying old logs
* update some expected test files
* fix jslint errors
* update javascript test
* update dimension names
* updates some expected test files
* add product view data to visitor details and add suggested segment values
* updates some expected test files
* rebuilt piwik.js
* adjust checked version
* update expected ui files
* updates some expected test files
* submodule updates
* apply some review feedback
* Show product views in action tooltips
* updates expected UI files
Co-authored-by: sgiehl <sgiehl@users.noreply.github.com>
Diffstat (limited to 'plugins/CustomVariables')
-rw-r--r-- | plugins/CustomVariables/Archiver.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php index c580220a47..b8970b27e1 100644 --- a/plugins/CustomVariables/Archiver.php +++ b/plugins/CustomVariables/Archiver.php @@ -12,6 +12,7 @@ use Piwik\Config; use Piwik\DataAccess\LogAggregator; use Piwik\DataArray; use Piwik\DataTable; +use Piwik\DbHelper; use Piwik\Metrics; use Piwik\Tracker\GoalManager; use Piwik\Tracker; @@ -107,7 +108,9 @@ class Archiver extends \Piwik\Plugin\Archiver // then we also query the "Product page view" price which was possibly recorded. $additionalSelects = false; - if (in_array($slot, array(\MatomoTracker::CVAR_INDEX_ECOMMERCE_ITEM_SKU, \MatomoTracker::CVAR_INDEX_ECOMMERCE_ITEM_NAME, \MatomoTracker::CVAR_INDEX_ECOMMERCE_ITEM_CATEGORY))) { + // Before Matomo 4.0.0 ecommerce views were tracked in custom variables + // So if Matomo was installed before still try to archive it the old way, as old data might be archived + if (version_compare(DbHelper::getInstallVersion(),'4.0.0-b2', '<') && in_array($slot, array(3, 4, 5))) { $additionalSelects = array($this->getSelectAveragePrice()); } $query = $this->getLogAggregator()->queryActionsByDimension($dimensions, $where, $additionalSelects); @@ -119,7 +122,7 @@ class Archiver extends \Piwik\Plugin\Archiver protected function getSelectAveragePrice() { - $field = "custom_var_v" . \MatomoTracker::CVAR_INDEX_ECOMMERCE_ITEM_PRICE; + $field = "custom_var_v2"; return LogAggregator::getSqlRevenue("AVG(log_link_visit_action." . $field . ")") . " as `" . Metrics::INDEX_ECOMMERCE_ITEM_PRICE_VIEWED . "`"; } |