diff options
17 files changed, 130 insertions, 100 deletions
diff --git a/core/DbHelper.php b/core/DbHelper.php index b8cf2509ea..761bf06e24 100644 --- a/core/DbHelper.php +++ b/core/DbHelper.php @@ -178,6 +178,21 @@ class DbHelper } /** + * Returns if the given table has an index with the given name + * + * @param string $table + * @param string $indexName + * + * @return bool + * @throws Exception + */ + public static function tableHasIndex($table, $indexName) + { + $result = Db::get()->fetchOne('SHOW INDEX FROM '.$table.' WHERE Key_name = ?', [$indexName]); + return !empty($result); + } + + /** * Get the SQL to create Piwik tables * * @return array array of strings containing SQL diff --git a/core/Tracker/Model.php b/core/Tracker/Model.php index ecf42a8076..8c4c4fb71b 100644 --- a/core/Tracker/Model.php +++ b/core/Tracker/Model.php @@ -16,6 +16,7 @@ use Psr\Log\LoggerInterface; class Model { + const CACHE_KEY_INDEX_IDSITE_IDVISITOR = 'log_visit_has_index_idsite_idvisitor'; public function createAction($visitAction) { @@ -418,7 +419,13 @@ class Model private function findVisitorByVisitorId($idVisitor, $select, $from, $where, $bindSql) { - // will use INDEX index_idsite_idvisitor (idsite, idvisitor) + $cache = Cache::getCacheGeneral(); + + // use INDEX index_idsite_idvisitor (idsite, idvisitor) if available + if (array_key_exists(self::CACHE_KEY_INDEX_IDSITE_IDVISITOR, $cache) && true === $cache[self::CACHE_KEY_INDEX_IDSITE_IDVISITOR]) { + $from .= ' FORCE INDEX (index_idsite_idvisitor) '; + } + $where .= ' AND idvisitor = ?'; $bindSql[] = $idVisitor; diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 6587e5ad13..84d5fc66a0 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -11,13 +11,16 @@ namespace Piwik\Plugins\CoreHome; use Piwik\Archive\ArchiveInvalidator; use Piwik\Columns\ComputedMetricFactory; use Piwik\Columns\MetricsList; +use Piwik\Common; use Piwik\Container\StaticContainer; +use Piwik\DbHelper; use Piwik\IP; use Piwik\Piwik; use Piwik\Plugin\ArchivedMetric; use Piwik\Plugin\ComputedMetric; use Piwik\Plugin\ThemeStyles; use Piwik\SettingsServer; +use Piwik\Tracker\Model as TrackerModel; /** * @@ -59,6 +62,9 @@ class CoreHome extends \Piwik\Plugin /** @var ArchiveInvalidator $archiveInvalidator */ $archiveInvalidator = StaticContainer::get(ArchiveInvalidator::class); $cacheGeneral[ArchiveInvalidator::TRACKER_CACHE_KEY] = $archiveInvalidator->getAllRememberToInvalidateArchivedReportsLater(); + + $hasIndex = DbHelper::tableHasIndex(Common::prefixTable('log_visit'), 'index_idsite_idvisitor'); + $cacheGeneral[TrackerModel::CACHE_KEY_INDEX_IDSITE_IDVISITOR] = $hasIndex; } public function addStylesheets(&$mergedContent) diff --git a/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php b/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php index 4324e58d54..5482b096ca 100644 --- a/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php +++ b/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php @@ -44,9 +44,10 @@ class VisitsWithUserIdAndCustomData extends Fixture foreach (array('user1', 'user2', 'user3', 'user4', false) as $key => $userId) { for ($numVisits = 0; $numVisits < ($key+1) * 10; $numVisits++) { + $visitDateTime = Date::factory($this->dateTime)->addHour($numVisits)->getDatetime(); + $t->setForceVisitDateTime($visitDateTime); $t->setUserId($userId); - $t->setPlugins($numVisits % 3 == 0, $numVisits % 5 == 0, $numVisits % 7 == 0); - $t->setBrowserHasCookies($numVisits % 3 == 0); + $t->setVisitorId(str_pad($numVisits.$key, 16, 'a')); $t->setCountry(self::$countryCodes[$numVisits % count(self::$countryCodes)]); if ($numVisits % 5 == 0) { @@ -72,7 +73,7 @@ class VisitsWithUserIdAndCustomData extends Fixture $t->setForceNewVisit(); $t->setUrl('http://example.org/my/dir/page' . ($numVisits % 4)); - $visitDateTime = Date::factory($this->dateTime)->addHour($numVisits*6)->getDatetime(); + $visitDateTime = Date::factory($this->dateTime)->addHour($numVisits+6)->getDatetime(); $t->setForceVisitDateTime($visitDateTime); if ($numVisits % 7 == 0) { @@ -82,7 +83,7 @@ class VisitsWithUserIdAndCustomData extends Fixture self::assertTrue($t->doTrackPageView('incredible title ' . ($numVisits % 3))); if ($numVisits % 9 == 0) { - $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour($numVisits*6.1)->getDatetime()); + $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour($numVisits+6.1)->getDatetime()); $t->addEcommerceItem('SKU VERY nice indeed ' . ($numVisits%3), 'PRODUCT name ' . ($numVisits%4), 'category ' . ($numVisits%5), $numVisits*2.79); self::assertTrue($t->doTrackEcommerceCartUpdate($numVisits*17)); } diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml index d73153a828..61570f95fd 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_pageviews>45</nb_pageviews> - <nb_uniq_pageviews>40</nb_uniq_pageviews> + <nb_uniq_pageviews>45</nb_uniq_pageviews> <nb_downloads>7</nb_downloads> <nb_uniq_downloads>7</nb_uniq_downloads> <nb_outlinks>0</nb_outlinks> diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml index e9d5ed7b27..66ddc67d77 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml @@ -2,26 +2,26 @@ <result> <row> <label>user3</label> - <nb_visits>34</nb_visits> + <nb_visits>33</nb_visits> <nb_actions>53</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>20</sum_visit_length> - <bounce_count>19</bounce_count> + <max_actions>4</max_actions> + <sum_visit_length>741</sum_visit_length> + <bounce_count>16</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>8</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> <row> <label>user1</label> - <nb_visits>12</nb_visits> + <nb_visits>13</nb_visits> <nb_actions>18</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>6</sum_visit_length> - <bounce_count>7</bounce_count> + <max_actions>2</max_actions> + <sum_visit_length>727</sum_visit_length> + <bounce_count>8</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>3</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml index ff76df488f..94efd54469 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_uniq_visitors>40</nb_uniq_visitors> <nb_users>2</nb_users> <nb_visits>46</nb_visits> <nb_actions>71</nb_actions> <nb_visits_converted>0</nb_visits_converted> - <bounce_count>26</bounce_count> - <sum_visit_length>26</sum_visit_length> - <max_actions>3</max_actions> - <bounce_rate>57%</bounce_rate> + <bounce_count>24</bounce_count> + <sum_visit_length>1468</sum_visit_length> + <max_actions>4</max_actions> + <bounce_rate>52%</bounce_rate> <nb_actions_per_visit>1.5</nb_actions_per_visit> - <avg_time_on_site>1</avg_time_on_site> + <avg_time_on_site>32</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml index 189d44ca43..2d7edd1635 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_pageviews>171</nb_pageviews> - <nb_uniq_pageviews>151</nb_uniq_pageviews> + <nb_uniq_pageviews>171</nb_uniq_pageviews> <nb_downloads>24</nb_downloads> <nb_uniq_downloads>24</nb_uniq_downloads> <nb_outlinks>0</nb_outlinks> diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml index 1e4420b714..88cc874456 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml @@ -2,50 +2,50 @@ <result> <row> <label>user4</label> - <nb_visits>45</nb_visits> - <nb_actions>74</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>28</sum_visit_length> - <bounce_count>22</bounce_count> + <nb_visits>43</nb_visits> + <nb_actions>70</nb_actions> + <max_actions>4</max_actions> + <sum_visit_length>1108</sum_visit_length> + <bounce_count>20</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>11</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>11</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>40</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>3</sum_daily_nb_users> </row> <row> <label>user3</label> - <nb_visits>34</nb_visits> + <nb_visits>33</nb_visits> <nb_actions>53</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>20</sum_visit_length> - <bounce_count>19</bounce_count> + <max_actions>4</max_actions> + <sum_visit_length>741</sum_visit_length> + <bounce_count>16</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>8</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> <row> <label>user2</label> - <nb_visits>22</nb_visits> + <nb_visits>23</nb_visits> <nb_actions>35</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>12</sum_visit_length> - <bounce_count>12</bounce_count> + <max_actions>2</max_actions> + <sum_visit_length>735</sum_visit_length> + <bounce_count>11</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>6</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>6</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>20</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> <row> <label>user1</label> - <nb_visits>12</nb_visits> + <nb_visits>13</nb_visits> <nb_actions>18</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>6</sum_visit_length> - <bounce_count>7</bounce_count> + <max_actions>2</max_actions> + <sum_visit_length>727</sum_visit_length> + <bounce_count>8</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>3</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml index 66190100e5..23b293cf53 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_uniq_visitors>150</nb_uniq_visitors> <nb_users>4</nb_users> - <nb_visits>164</nb_visits> + <nb_visits>191</nb_visits> <nb_actions>264</nb_actions> <nb_visits_converted>0</nb_visits_converted> - <bounce_count>86</bounce_count> - <sum_visit_length>97</sum_visit_length> - <max_actions>3</max_actions> - <bounce_rate>52%</bounce_rate> - <nb_actions_per_visit>1.6</nb_actions_per_visit> - <avg_time_on_site>1</avg_time_on_site> + <bounce_count>120</bounce_count> + <sum_visit_length>5492</sum_visit_length> + <max_actions>4</max_actions> + <bounce_rate>63%</bounce_rate> + <nb_actions_per_visit>1.4</nb_actions_per_visit> + <avg_time_on_site>29</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml index c693c3bcc9..d6b21a8339 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_pageviews>57</nb_pageviews> - <nb_uniq_pageviews>50</nb_uniq_pageviews> + <nb_uniq_pageviews>57</nb_uniq_pageviews> <nb_downloads>8</nb_downloads> <nb_uniq_downloads>8</nb_uniq_downloads> <nb_outlinks>0</nb_outlinks> <nb_uniq_outlinks>0</nb_uniq_outlinks> - <nb_searches>12</nb_searches> + <nb_searches>10</nb_searches> <nb_keywords>8</nb_keywords> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml index 06f94bf4e8..9f798cd7bf 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml @@ -2,26 +2,26 @@ <result> <row> <label>user4</label> - <nb_visits>45</nb_visits> - <nb_actions>74</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>28</sum_visit_length> - <bounce_count>22</bounce_count> + <nb_visits>43</nb_visits> + <nb_actions>70</nb_actions> + <max_actions>4</max_actions> + <sum_visit_length>1108</sum_visit_length> + <bounce_count>20</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>11</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>11</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>40</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>3</sum_daily_nb_users> </row> <row> <label>user1</label> - <nb_visits>12</nb_visits> + <nb_visits>13</nb_visits> <nb_actions>18</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>6</sum_visit_length> - <bounce_count>7</bounce_count> + <max_actions>2</max_actions> + <sum_visit_length>727</sum_visit_length> + <bounce_count>8</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>3</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml index a8c9a77cac..0dec751572 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_uniq_visitors>50</nb_uniq_visitors> <nb_users>2</nb_users> - <nb_visits>57</nb_visits> - <nb_actions>92</nb_actions> + <nb_visits>56</nb_visits> + <nb_actions>88</nb_actions> <nb_visits_converted>0</nb_visits_converted> - <bounce_count>29</bounce_count> - <sum_visit_length>34</sum_visit_length> - <max_actions>3</max_actions> - <bounce_rate>51%</bounce_rate> + <bounce_count>28</bounce_count> + <sum_visit_length>1835</sum_visit_length> + <max_actions>4</max_actions> + <bounce_rate>50%</bounce_rate> <nb_actions_per_visit>1.6</nb_actions_per_visit> - <avg_time_on_site>1</avg_time_on_site> + <avg_time_on_site>33</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml index 4269b53424..06508b8e7a 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_pageviews>57</nb_pageviews> - <nb_uniq_pageviews>50</nb_uniq_pageviews> + <nb_uniq_pageviews>57</nb_uniq_pageviews> <nb_downloads>8</nb_downloads> <nb_uniq_downloads>8</nb_uniq_downloads> <nb_outlinks>0</nb_outlinks> diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml index d9abec4587..2fe5964a40 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml @@ -2,26 +2,26 @@ <result> <row> <label>user3</label> - <nb_visits>34</nb_visits> + <nb_visits>33</nb_visits> <nb_actions>53</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>20</sum_visit_length> - <bounce_count>19</bounce_count> + <max_actions>4</max_actions> + <sum_visit_length>741</sum_visit_length> + <bounce_count>16</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>8</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> <row> <label>user2</label> - <nb_visits>22</nb_visits> + <nb_visits>23</nb_visits> <nb_actions>35</nb_actions> - <max_actions>3</max_actions> - <sum_visit_length>12</sum_visit_length> - <bounce_count>12</bounce_count> + <max_actions>2</max_actions> + <sum_visit_length>735</sum_visit_length> + <bounce_count>11</bounce_count> <nb_visits_converted>0</nb_visits_converted> - <sum_daily_nb_uniq_visitors>6</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>6</sum_daily_nb_users> + <sum_daily_nb_uniq_visitors>20</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>2</sum_daily_nb_users> </row> </result>
\ No newline at end of file diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml index 7011733c70..22d38cc245 100644 --- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml +++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_uniq_visitors>50</nb_uniq_visitors> <nb_users>2</nb_users> <nb_visits>56</nb_visits> <nb_actions>88</nb_actions> <nb_visits_converted>0</nb_visits_converted> - <bounce_count>31</bounce_count> - <sum_visit_length>32</sum_visit_length> - <max_actions>3</max_actions> - <bounce_rate>55%</bounce_rate> + <bounce_count>27</bounce_count> + <sum_visit_length>1476</sum_visit_length> + <max_actions>4</max_actions> + <bounce_rate>48%</bounce_rate> <nb_actions_per_visit>1.6</nb_actions_per_visit> - <avg_time_on_site>1</avg_time_on_site> + <avg_time_on_site>26</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php b/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php index 3c5ac0fcbd..bd150ae4c9 100644 --- a/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php +++ b/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php @@ -37,6 +37,7 @@ class TrackFewVisitsAndCreateUsers extends Fixture foreach (array('user1', 'user2', 'user3') as $key => $userId) { for ($numVisits = 0; $numVisits < ($key+1) * 10; $numVisits++) { $t->setUserId($userId); + $t->setVisitorId(str_pad($numVisits.$key, 16, 'a')); if ($numVisits % 5 == 0) { $t->doTrackSiteSearch('some search term'); } |