diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index f9604c2040040066e581a98b53110180f7e6505a..265ce37bb1665bf0c44f5c444ccbaad1712b3c53 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -368,27 +368,22 @@ class Report * * This method should be used in **Plugin.get** API methods. * - * @param string[]|null $allColumns The list of all available columns. Defaults to this report's metrics - * and processed metrics. + * @param string[]|null $allMetrics The list of all available metrics. Defaults to this report's metrics. * @param string[]|null $restrictToColumns The requested columns. * @return string[] */ - public function getMetricsRequiredForReport($allColumns = null, $restrictToColumns = null) + public function getMetricsRequiredForReport($allMetrics = null, $restrictToColumns = null) { - if (empty($allColumns)) { - $allColumns = $this->metrics; - - foreach ($this->processedMetrics as $processedMetric) { - $allColumns[] = $processedMetric instanceof ProcessedMetric ? $processedMetric->getName() : $processedMetric; - } + if (empty($allMetrics)) { + $allMetrics = $this->metrics; } if (empty($restrictToColumns)) { - $restrictToColumns = $allColumns; + $restrictToColumns = $allMetrics; } $processedMetricsById = $this->getProcessedMetricsById(); - $metricsSet = array_flip($allColumns); + $metricsSet = array_flip($allMetrics); $metrics = array(); foreach ($restrictToColumns as $column) { @@ -420,6 +415,17 @@ class Report return $this->getMetricTranslations($this->processedMetrics); } + /** + * Returns the array of all metrics displayed by this report. + * + * @return array + * @api + */ + public function getAllMetrics() + { + return array_keys(array_merge($this->getMetrics(), $this->getProcessedMetrics())); + } + /** * Returns an array of metric documentations and their corresponding translations. Eg * `array('nb_visits' => 'If a visitor comes to your website for the first time or if he visits a page more than 30 minutes after...')`. diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index 1e65acf05f3be53d4635073fb2620d56658e6e6d..955825a092b69a0cc8d0a35e2bbf2351216eb907 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -343,27 +343,28 @@ class API extends \Piwik\Plugin\API // Mapping string idGoal to internal ID $idGoal = self::convertSpecialGoalIds($idGoal); + $isEcommerceGoal = $idGoal === GoalManager::IDGOAL_ORDER || $idGoal === GoalManager::IDGOAL_CART; $allMetrics = Goals::getGoalColumns($idGoal); - $requestedColumns = Piwik::getArrayFromApiParameter($columns); - $columnsToGet = Report::factory("Goals", "get")->getMetricsRequiredForReport($allMetrics, $requestedColumns); - $inDbMetricNames = array_map(function ($value) use ($idGoal) { return Archiver::getRecordName($value, $idGoal); }, $columnsToGet); + $report = Report::factory("Goals", "get"); + $columnsToGet = $report->getMetricsRequiredForReport($allMetrics, $requestedColumns); + + $inDbMetricNames = array_map(function ($name) use ($idGoal) { + return $name == 'nb_visits' ? $name : Archiver::getRecordName($name, $idGoal); + }, $columnsToGet); $dataTable = $archive->getDataTableFromNumeric($inDbMetricNames); $newNameMapping = array_combine($inDbMetricNames, $columnsToGet); $dataTable->filter('ReplaceColumnNames', array($newNameMapping)); - $dataTable->deleteColumns(array_diff($requestedColumns, $columnsToGet)); - // TODO: this should be in Goals/Get.php but it depends on idGoal parameter which isn't always in _GET (ie, // it's not in ProcessedReport.php). more refactoring must be done to report class before this can be // corrected. if ((in_array('avg_order_revenue', $requestedColumns) || empty($requestedColumns)) - && ($idGoal === GoalManager::IDGOAL_ORDER - || $idGoal === GoalManager::IDGOAL_CART) + && $isEcommerceGoal ) { $dataTable->filter(function (DataTable $table) { $extraProcessedMetrics = $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME); @@ -372,6 +373,16 @@ class API extends \Piwik\Plugin\API }); } + // remove temporary metrics that were not explicitly requested + $allColumns = $allMetrics; + $allColumns[] = 'conversion_rate'; + if ($isEcommerceGoal) { + $allColumns[] = 'avg_order_revenue'; + } + + $columnsToShow = $requestedColumns ?: $allColumns; + $dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow)); + return $dataTable; } diff --git a/plugins/Goals/Archiver.php b/plugins/Goals/Archiver.php index 146cdccd6fb70fd44a341e72e36801f04e8e2472..379752a6e2eb8720b5ba5a4887d53cbc5363d052 100644 --- a/plugins/Goals/Archiver.php +++ b/plugins/Goals/Archiver.php @@ -154,7 +154,6 @@ class Archiver extends \Piwik\Plugin\Archiver // Stats for all goals $nbConvertedVisits = $this->getProcessor()->getNumberOfVisitsConverted(); $metrics = array( - self::getRecordName('conversion_rate') => $this->getConversionRate($nbConvertedVisits), self::getRecordName('nb_conversions') => $totalConversions, self::getRecordName('nb_visits_converted') => $nbConvertedVisits, self::getRecordName('revenue') => $totalRevenue, @@ -172,11 +171,6 @@ class Archiver extends \Piwik\Plugin\Archiver $recordName = self::getRecordName($metricName, $idGoal); $numericRecords[$recordName] = $value; } - if (!empty($array[Metrics::INDEX_GOAL_NB_VISITS_CONVERTED])) { - $conversion_rate = $this->getConversionRate($array[Metrics::INDEX_GOAL_NB_VISITS_CONVERTED]); - $recordName = self::getRecordName('conversion_rate', $idGoal); - $numericRecords[$recordName] = $conversion_rate; - } } return $numericRecords; } @@ -195,12 +189,6 @@ class Archiver extends \Piwik\Plugin\Archiver return 'Goal_' . $idGoalStr . $recordName; } - protected function getConversionRate($count) - { - $visits = $this->getProcessor()->getNumberOfVisits(); - return round(100 * $count / $visits, GoalManager::REVENUE_PRECISION); - } - protected function insertReports($recordName, $visitsToConversions) { foreach ($visitsToConversions as $idGoal => $table) { @@ -389,19 +377,13 @@ class Archiver extends \Piwik\Plugin\Archiver $fieldsToSum = array(); foreach ($goalIdsToSum as $goalId) { $metricsToSum = Goals::getGoalColumns($goalId); - unset($metricsToSum[array_search('conversion_rate', $metricsToSum)]); foreach ($metricsToSum as $metricName) { $fieldsToSum[] = self::getRecordName($metricName, $goalId); } } - $records = $this->getProcessor()->aggregateNumericMetrics($fieldsToSum); + $this->getProcessor()->aggregateNumericMetrics($fieldsToSum); - // also recording conversion_rate for each goal foreach ($goalIdsToSum as $goalId) { - $nb_conversions = $records[self::getRecordName('nb_visits_converted', $goalId)]; - $conversion_rate = $this->getConversionRate($nb_conversions); - $this->getProcessor()->insertNumericRecord(self::getRecordName('conversion_rate', $goalId), $conversion_rate); - // sum up the visits to conversion data table & the days to conversion data table $this->getProcessor()->aggregateDataTableRecords(array( self::getRecordName(self::VISITS_UNTIL_RECORD_NAME, $goalId), diff --git a/plugins/Goals/Reports/Get.php b/plugins/Goals/Reports/Get.php index 1d16d0c5bc57266c9dbf5c607cbe1718ce200840..f9c8dc2355b2122e4c7f0c6b08a88a18d1dc2d90 100644 --- a/plugins/Goals/Reports/Get.php +++ b/plugins/Goals/Reports/Get.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\Goals\Reports; use Piwik\Piwik; +use Piwik\Plugins\CoreHome\Columns\Metrics\ConversionRate; class Get extends BaseGoal { @@ -17,11 +18,11 @@ class Get extends BaseGoal parent::init(); $this->name = Piwik::translate('Goals_Goals'); - $this->processedMetrics = array('avg_order_revenue'); + $this->processedMetrics = array(new ConversionRate(), 'avg_order_revenue'); $this->documentation = ''; // TODO $this->order = 1; $this->orderGoal = 50; - $this->metrics = array('nb_conversions', 'nb_visits_converted', 'conversion_rate', 'revenue'); + $this->metrics = array('nb_conversions', 'nb_visits_converted', 'revenue'); $this->parameters = null; } diff --git a/plugins/Goals/Reports/GetVisitsUntilConversion.php b/plugins/Goals/Reports/GetVisitsUntilConversion.php index 6be172a8661e0dbf1a440ef012d4e23750a5a79c..8d7c27e0271818f46bb3381b5896b2efe631fb5f 100644 --- a/plugins/Goals/Reports/GetVisitsUntilConversion.php +++ b/plugins/Goals/Reports/GetVisitsUntilConversion.php @@ -22,7 +22,7 @@ class GetVisitsUntilConversion extends BaseGoal $this->name = Piwik::translate('Goals_VisitsUntilConv'); $this->dimension = new VisitsUntilConversion(); $this->constantRowsCount = true; - $this->processedMetrics = false; + $this->processedMetrics = array(); $this->parameters = array(); $this->metrics = array('nb_conversions'); $this->order = 5; diff --git a/plugins/Goals/Reports/GetVisitsUntilConversionEcommerceOrder.php b/plugins/Goals/Reports/GetVisitsUntilConversionEcommerceOrder.php index ba292c8b717fa1bf0a9f6b53fb91cd039fed7571..0e5d227e7e02c8b78015d292c9e98dee2676a0d2 100644 --- a/plugins/Goals/Reports/GetVisitsUntilConversionEcommerceOrder.php +++ b/plugins/Goals/Reports/GetVisitsUntilConversionEcommerceOrder.php @@ -22,7 +22,7 @@ class GetVisitsUntilConversionEcommerceOrder extends BaseEcommerce $this->name = Piwik::translate('General_EcommerceOrders') . ' - ' . Piwik::translate('Goals_VisitsUntilConv'); $this->dimension = new VisitsUntilConversion(); $this->constantRowsCount = true; - $this->processedMetrics = false; + $this->processedMetrics = array(); $this->metrics = array('nb_conversions'); $this->order = 11; diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_day.xml index 6e377c1d4109be99c593bcc9a2e5170c1652a834..b82a3a8c27357b3f08c904d458610467cac4c4b0 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_day.xml @@ -2,8 +2,8 @@ <result> <nb_conversions>2</nb_conversions> <nb_visits_converted>2</nb_visits_converted> - <conversion_rate>66.67</conversion_rate> <revenue>5020.22</revenue> <items>8</items> <avg_order_revenue>2510.11</avg_order_revenue> + <conversion_rate>66.67%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_week.xml index f745e2b50a8bd4a82a7d8125fba263143937e8c8..e69257b0fa67752622395912e07aaa70473881f3 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalAbandonedCart__Goals.get_week.xml @@ -2,8 +2,8 @@ <result> <nb_conversions>3</nb_conversions> <nb_visits_converted>3</nb_visits_converted> - <conversion_rate>60</conversion_rate> <revenue>7530.33</revenue> <items>12</items> <avg_order_revenue>2510.11</avg_order_revenue> + <conversion_rate>60%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_day.xml index 28ecffa619d3992aaddd1a7d9b6925f8ea3c1c1b..1245b5cd8f33fb084d5ddfcf9a00bf42fdd3ecbd 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_day.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>1</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>33.33</conversion_rate> <revenue>10</revenue> + <conversion_rate>33.33%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_week.xml index 46934b1c19c2498646c35988092f745ac0d4fa19..b5daa8ba92cc3f64b18178b6a3a1888f17cc94e1 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalMatchTitle__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>1</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>20</conversion_rate> <revenue>10</revenue> + <conversion_rate>20%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_day.xml index ebcd36522333d3e72cf3ad1d96bea4b25d9a598c..b1c28a0a8dae1db860166cbf472052fe21c88173 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_day.xml @@ -2,7 +2,6 @@ <result> <nb_conversions>2</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>33.33</conversion_rate> <revenue>3111.11</revenue> <revenue_subtotal>2500</revenue_subtotal> <revenue_tax>511</revenue_tax> @@ -10,4 +9,5 @@ <revenue_discount>666</revenue_discount> <items>10</items> <avg_order_revenue>1555.56</avg_order_revenue> + <conversion_rate>33.33%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_week.xml index ea6729364c998ea032bf3db88fad0bb280a9a152..92abb4962b54fa8c51c6a498b90dc9cd42ad4724 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOrder__Goals.get_week.xml @@ -2,7 +2,6 @@ <result> <nb_conversions>4</nb_conversions> <nb_visits_converted>2</nb_visits_converted> - <conversion_rate>40</conversion_rate> <revenue>13351.11</revenue> <revenue_subtotal>2700</revenue_subtotal> <revenue_tax>531</revenue_tax> @@ -10,4 +9,5 @@ <revenue_discount>686</revenue_discount> <items>12</items> <avg_order_revenue>3337.78</avg_order_revenue> + <conversion_rate>40%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_day.xml index fc23e7158e9a201b885992c6bab4455889f5b395..837cc2b4c663c5f6b3ad4a284008ae25fe26295c 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_day.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>3</nb_conversions> <nb_visits_converted>2</nb_visits_converted> - <conversion_rate>66.67</conversion_rate> <revenue>3121.11</revenue> + <conversion_rate>66.67%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_week.xml index 221f89f82644bcadde544c0f5d7cdc8d204ea948..c9cd54530d69634e9ddb7577a30a38a16528509b 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_GoalOverall__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>5</nb_conversions> <nb_visits_converted>4</nb_visits_converted> - <conversion_rate>80</conversion_rate> <revenue>13361.11</revenue> + <conversion_rate>80%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_AbandonedCart__API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_AbandonedCart__API.getProcessedReport_day.xml index 56e26922bd91ea184867493ef0c6eb92e5fa1572..3e099b56923247a9e489ef3dbeb6bcd3f3b5300c 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_AbandonedCart__API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_AbandonedCart__API.getProcessedReport_day.xml @@ -35,10 +35,10 @@ </columns> <reportData> <nb_conversions>2</nb_conversions> - <conversion_rate>66.67%</conversion_rate> <revenue>$ 5020.22</revenue> <items>8</items> <avg_order_revenue>$ 2510.11</avg_order_revenue> + <conversion_rate>66.67%</conversion_rate> </reportData> <reportMetadata /> <reportTotal> diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_NormalGoal__API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_NormalGoal__API.getProcessedReport_day.xml index a1494e0f0f204e081fff49512f2abb20e74efa1d..ea5aedc5547f3e93710c81c227efb2de664338e5 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_NormalGoal__API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_NormalGoal__API.getProcessedReport_day.xml @@ -13,13 +13,13 @@ <metrics> <nb_conversions>Conversions</nb_conversions> <nb_visits_converted>Visits with Conversions</nb_visits_converted> - <conversion_rate>Conversion Rate</conversion_rate> <revenue>Revenue</revenue> </metrics> <metricsDocumentation> <conversion_rate>The percentage of visits that triggered a goal conversion.</conversion_rate> </metricsDocumentation> <processedMetrics> + <conversion_rate>Conversion Rate</conversion_rate> <avg_order_revenue>Average Order Value</avg_order_revenue> </processedMetrics> <imageGraphUrl>index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=Goals&apiAction=get&idGoal=1&period=day&date=2011-03-07,2011-04-05</imageGraphUrl> @@ -29,15 +29,15 @@ <columns> <nb_conversions>Conversions</nb_conversions> <nb_visits_converted>Visits with Conversions</nb_visits_converted> - <conversion_rate>Conversion Rate</conversion_rate> <revenue>Revenue</revenue> + <conversion_rate>Conversion Rate</conversion_rate> <avg_order_revenue>Average Order Value</avg_order_revenue> </columns> <reportData> <nb_conversions>1</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>33.33%</conversion_rate> <revenue>$ 10</revenue> + <conversion_rate>33.33%</conversion_rate> <avg_order_revenue>$ 0</avg_order_revenue> </reportData> <reportMetadata /> diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_Order__API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_Order__API.getProcessedReport_day.xml index 2e35bddc6570ba73798acc034195670540719114..99d9d6ab6950db804aacb2d7fd5620c2cb5dec85 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_Order__API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Metadata_Goals.Get_Order__API.getProcessedReport_day.xml @@ -46,7 +46,6 @@ <reportData> <nb_conversions>2</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>33.33%</conversion_rate> <revenue>$ 3111.11</revenue> <revenue_subtotal>$ 2500</revenue_subtotal> <revenue_tax>$ 511</revenue_tax> @@ -54,6 +53,7 @@ <revenue_discount>$ 666</revenue_discount> <items>10</items> <avg_order_revenue>$ 1555.56</avg_order_revenue> + <conversion_rate>33.33%</conversion_rate> </reportData> <reportMetadata /> <reportTotal> diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentNoVisit_HaveConvertedNonExistingGoal__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentNoVisit_HaveConvertedNonExistingGoal__Goals.get_week.xml index 257dd359a5ad6465d9310200af63d2d04ae401a6..2cb7df5a9ebb487bf6f925832c407ac95331e313 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentNoVisit_HaveConvertedNonExistingGoal__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentNoVisit_HaveConvertedNonExistingGoal__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>0</nb_conversions> <nb_visits_converted>0</nb_visits_converted> - <conversion_rate>0</conversion_rate> <revenue>0</revenue> + <conversion_rate>0%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasConvertedGoal__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasConvertedGoal__Goals.get_week.xml index 78dc5020d7fa3d9262e8bcab007951942e925232..8405e1d37a77bffd95f7879497e268b1b0bb7415 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasConvertedGoal__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasConvertedGoal__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>1</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>100</conversion_rate> <revenue>10</revenue> + <conversion_rate>100%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasNotOrderedAndConvertedGoal__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasNotOrderedAndConvertedGoal__Goals.get_week.xml index 78dc5020d7fa3d9262e8bcab007951942e925232..8405e1d37a77bffd95f7879497e268b1b0bb7415 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasNotOrderedAndConvertedGoal__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_SegmentVisitHasNotOrderedAndConvertedGoal__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>1</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>100</conversion_rate> <revenue>10</revenue> + <conversion_rate>100%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Website2__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Website2__Goals.get_week.xml index d896b423d72307e248815dc6a0d4a9154c4b5bdc..76d1b80343b7a8e458e7066c56066fbc0fbfaa81 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Website2__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_Website2__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>1</nb_conversions> <nb_visits_converted>1</nb_visits_converted> - <conversion_rate>50</conversion_rate> <revenue>250</revenue> + <conversion_rate>50%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_day.xml index fc23e7158e9a201b885992c6bab4455889f5b395..837cc2b4c663c5f6b3ad4a284008ae25fe26295c 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_day.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>3</nb_conversions> <nb_visits_converted>2</nb_visits_converted> - <conversion_rate>66.67</conversion_rate> <revenue>3121.11</revenue> + <conversion_rate>66.67%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_week.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_week.xml index 221f89f82644bcadde544c0f5d7cdc8d204ea948..c9cd54530d69634e9ddb7577a30a38a16528509b 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_week.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__Goals.get_week.xml @@ -2,6 +2,6 @@ <result> <nb_conversions>5</nb_conversions> <nb_visits_converted>4</nb_visits_converted> - <conversion_rate>80</conversion_rate> <revenue>13361.11</revenue> + <conversion_rate>80%</conversion_rate> </result> \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv index 1092815ed42fd3f3fd0ae1d6d6d663f57529d98e..51077efcb5e8319af56b6a827837ce4f8a95326e 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv @@ -128,8 +128,8 @@ Polish (pl),4,12,75%,3,00:25:32,25% French (fr),1,4,100%,4,00:12:01,0% Ecommerce Orders -nb_conversions,nb_visits_converted,conversion_rate,revenue,revenue_subtotal,revenue_tax,revenue_shipping,revenue_discount,items,avg_order_revenue -4,2,40%,$ 13351.11,$ 2700,$ 531,$ 120.11,$ 686,12,$ 3337.78 +nb_conversions,nb_visits_converted,revenue,revenue_subtotal,revenue_tax,revenue_shipping,revenue_discount,items,avg_order_revenue,conversion_rate +4,2,$ 13351.11,$ 2700,$ 531,$ 120.11,$ 686,12,$ 3337.78,40% Ecommerce Orders - Visits to Conversion label,nb_conversions @@ -165,8 +165,8 @@ label,nb_conversions 365+ days,0 Abandoned Carts -nb_conversions,conversion_rate,revenue,items,avg_order_revenue -3,60%,$ 7530.33,12,$ 2510.11 +nb_conversions,revenue,items,avg_order_revenue,conversion_rate +3,$ 7530.33,12,$ 2510.11,60% Abandoned Carts - Visits to Conversion label,nb_conversions @@ -326,8 +326,8 @@ Social Networks No data available Goals -nb_conversions,nb_visits_converted,conversion_rate,revenue,avg_order_revenue -5,4,80%,$ 13361.11,$ 0 +nb_conversions,nb_visits_converted,revenue,conversion_rate,avg_order_revenue +5,4,$ 13361.11,80%,$ 0 Visits to Conversion label,nb_conversions,revenue @@ -363,8 +363,8 @@ label,nb_conversions,revenue 365+ days,0,$ 0 Goal title match triggered ONCE -nb_conversions,nb_visits_converted,conversion_rate,revenue,avg_order_revenue -1,1,20%,$ 10,$ 0 +nb_conversions,nb_visits_converted,revenue,conversion_rate,avg_order_revenue +1,1,$ 10,20%,$ 0 title match triggered ONCE - Visits to Conversion label,nb_conversions diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html index e51c812c77b08658e5230d15f29c9cd9283e9c6b..e5eefe4d3091d5cdab8cb0750fccc6659cd00cdd 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html @@ -2826,14 +2826,6 @@ </tr> <tr style=""> - <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Conversion Rate </td> - <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - 40% - </td> - </tr> - - <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Revenue </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> @@ -2841,7 +2833,7 @@ </td> </tr> - <tr style=""> + <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Subtotal </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> @@ -2849,7 +2841,7 @@ </td> </tr> - <tr style="background-color: rgb(249,250,250)"> + <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Tax </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> @@ -2857,7 +2849,7 @@ </td> </tr> - <tr style=""> + <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Shipping </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> @@ -2865,7 +2857,7 @@ </td> </tr> - <tr style="background-color: rgb(249,250,250)"> + <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Discount </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> @@ -2873,7 +2865,7 @@ </td> </tr> - <tr style=""> + <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Purchased Products </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> @@ -2881,12 +2873,20 @@ </td> </tr> - <tr style="background-color: rgb(249,250,250)"> + <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> Average Order Value </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> $ 3337.78 </td> + </tr> + + <tr style="background-color: rgb(249,250,250)"> + <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> + Conversion Rate </td> + <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> + 40% + </td> </tr> </tbody> </table> @@ -3181,33 +3181,33 @@ <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Conversion Rate </td> + Revenue left in cart </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - 60% + $ 7530.33 </td> </tr> <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Revenue left in cart </td> + Products left in cart </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - $ 7530.33 + 12 </td> </tr> <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Products left in cart </td> + Average Order Value </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - 12 + $ 2510.11 </td> </tr> <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Average Order Value </td> + Conversion Rate </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - $ 2510.11 + 60% </td> </tr> </tbody> @@ -4825,17 +4825,17 @@ <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Conversion Rate </td> + Revenue </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - 80% + $ 13361.11 </td> </tr> <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Revenue </td> + Conversion Rate </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - $ 13361.11 + 80% </td> </tr> @@ -5234,17 +5234,17 @@ <tr style=""> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Conversion Rate </td> + Revenue </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - 20% + $ 10 </td> </tr> <tr style="background-color: rgb(249,250,250)"> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - Revenue </td> + Conversion Rate </td> <td style="font-size: 11pt; border-bottom: 1px solid rgb(231,231,231); padding: 5px 0 5px 5px;"> - $ 10 + 20% </td> </tr>