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:
Diffstat (limited to 'core/ArchiveProcessing/Day.php')
-rw-r--r--core/ArchiveProcessing/Day.php44
1 files changed, 27 insertions, 17 deletions
diff --git a/core/ArchiveProcessing/Day.php b/core/ArchiveProcessing/Day.php
index df823b978b..5193a39562 100644
--- a/core/ArchiveProcessing/Day.php
+++ b/core/ArchiveProcessing/Day.php
@@ -44,12 +44,12 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
sum(case visit_total_actions when 1 then 1 else 0 end) as bounce_count,
sum(case visit_goal_converted when 1 then 1 else 0 end) as nb_visits_converted
FROM ".$this->logTable."
- WHERE visit_server_date = ?
+ WHERE visit_last_action_time >= ?
+ AND visit_last_action_time <= ?
AND idsite = ?
- GROUP BY visit_server_date
ORDER BY NULL";
- $row = $this->db->fetchRow($query, array($this->strDateStart,$this->idsite ) );
- if($row === false || $row === null)
+ $row = $this->db->fetchRow($query, array($this->getStartDatetimeUTC(), $this->getEndDatetimeUTC(), $this->idsite ) );
+ if($row === false || $row === null || $row['nb_visits'] == 0)
{
return;
}
@@ -87,9 +87,10 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
{
$query = "SELECT $select
FROM ".$this->logTable."
- WHERE visit_server_date = ?
- AND idsite = ?";
- $data = $this->db->fetchRow($query, array( $this->strDateStart, $this->idsite ));
+ WHERE visit_last_action_time >= ?
+ AND visit_last_action_time <= ?
+ AND idsite = ?";
+ $data = $this->db->fetchRow($query, array( $this->getStartDatetimeUTC(), $this->getEndDatetimeUTC(), $this->idsite ));
foreach($data as $label => &$count)
{
@@ -152,11 +153,12 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
sum(case visit_total_actions when 1 then 1 else 0 end) as bounce_count,
sum(case visit_goal_converted when 1 then 1 else 0 end) as nb_visits_converted
FROM ".$this->logTable."
- WHERE visit_server_date = ?
- AND idsite = ?
+ WHERE visit_last_action_time >= ?
+ AND visit_last_action_time <= ?
+ AND idsite = ?
GROUP BY label
ORDER BY NULL";
- $query = $this->db->query($query, array( $this->strDateStart, $this->idsite ) );
+ $query = $this->db->query($query, array( $this->getStartDatetimeUTC(), $this->getEndDatetimeUTC(), $this->idsite ) );
$interest = array();
while($row = $query->fetch())
@@ -327,11 +329,12 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
sum(revenue) as revenue
$segments
FROM ".$this->logConversionTable."
- WHERE visit_server_date = ?
- AND idsite = ?
+ WHERE server_time >= ?
+ AND server_time <= ?
+ AND idsite = ?
GROUP BY idgoal $segments
ORDER BY NULL";
- $query = $this->db->query($query, array( $this->strDateStart, $this->idsite ));
+ $query = $this->db->query($query, array( $this->getStartDatetimeUTC(), $this->getEndDatetimeUTC(), $this->idsite ));
return $query;
}
@@ -342,15 +345,20 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
sum(revenue) as revenue,
$segment as label
FROM ".$this->logConversionTable."
- WHERE visit_server_date = ?
- AND idsite = ?
+ WHERE server_time >= ?
+ AND server_time <= ?
+ AND idsite = ?
GROUP BY idgoal, label
ORDER BY NULL";
- $query = $this->db->query($query, array( $this->strDateStart, $this->idsite ));
+ $query = $this->db->query($query, array( $this->getStartDatetimeUTC(), $this->getEndDatetimeUTC(), $this->idsite ));
return $query;
}
/**
+ * Given an array of stats, it will process the sum of goal conversions
+ * and sum of revenue and add it in the stats array in two new fields.
+ *
+ * @param $interestByLabel Passed by reference, it will be modified as follows:
* Input:
* array(
* LABEL => array( Piwik_Archive::INDEX_NB_VISITS => X,
@@ -362,10 +370,12 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
* LABEL2 => array( Piwik_Archive::INDEX_NB_VISITS => Y, [...] )
* );
*
+ *
* Output:
* array(
* LABEL => array( Piwik_Archive::INDEX_NB_VISITS => X,
- *
+ * Piwik_Archive::INDEX_NB_CONVERSIONS => Y, // sum of all conversions
+ * Piwik_Archive::INDEX_REVENUE => Z, // sum of all revenue
* Piwik_Archive::INDEX_GOALS => array(
* idgoal1 => array( [...] ),
* idgoal2 => array( [...] ),