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:
authorMatthieu Aubry <matt@piwik.org>2015-12-04 08:36:20 +0300
committerMatthieu Aubry <matt@piwik.org>2015-12-04 08:36:20 +0300
commit05852332f2a693b0cc313152fcb742fc063aa995 (patch)
tree13cc3bf7a46ba342d1171221a9dfc76cce0dd049 /plugins/Referrers/Columns
parent24839681ebba4d8cd021009b7261f459b91cca87 (diff)
parentea0ee79d05e7d27df4c360e5a28bcfa2834ab183 (diff)
Merge pull request #9320 from piwik/website_path
Added support to specify a path in a website URL and Piwik will consider the path during tracking
Diffstat (limited to 'plugins/Referrers/Columns')
-rw-r--r--plugins/Referrers/Columns/Base.php34
-rw-r--r--plugins/Referrers/Columns/Campaign.php2
2 files changed, 26 insertions, 10 deletions
diff --git a/plugins/Referrers/Columns/Base.php b/plugins/Referrers/Columns/Base.php
index 900c7bba63..a7e7eaf1e3 100644
--- a/plugins/Referrers/Columns/Base.php
+++ b/plugins/Referrers/Columns/Base.php
@@ -12,6 +12,8 @@ use Piwik\Common;
use Piwik\Piwik;
use Piwik\Plugin\Dimension\VisitDimension;
use Piwik\Plugins\Referrers\SearchEngine AS SearchEngineDetection;
+use Piwik\Plugins\SitesManager\SiteUrls;
+use Piwik\Tracker\Cache;
use Piwik\Tracker\PageUrl;
use Piwik\Tracker\Request;
use Piwik\Tracker\Visit;
@@ -251,20 +253,34 @@ abstract class Base extends VisitDimension
*/
protected function detectReferrerDirectEntry()
{
- if (!empty($this->referrerHost)) {
- // is the referrer host the current host?
- if (isset($this->currentUrlParse['host'])) {
- $currentHost = Common::mb_strtolower($this->currentUrlParse['host'], 'UTF-8');
- if ($currentHost == Common::mb_strtolower($this->referrerHost, 'UTF-8')) {
- $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
- return true;
- }
+ if (empty($this->referrerHost)) {
+ return false;
+ }
+
+ $cache = Cache::getCacheGeneral();
+
+ if (!empty($cache['allUrlsByHostAndIdSite'])) {
+ $directEntry = new SiteUrls();
+ $matchingSites = $directEntry->getIdSitesMatchingUrl($this->referrerUrlParse, $cache['allUrlsByHostAndIdSite']);
+
+ if (isset($matchingSites) && is_array($matchingSites) && in_array($this->idsite, $matchingSites)) {
+ $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
+ return true;
+ } elseif (isset($matchingSites)) {
+ return false;
}
- if (Visit::isHostKnownAliasHost($this->referrerHost, $this->idsite)) {
+ }
+
+ // fallback logic if the referrer domain is not known to any site to not break BC
+ if (isset($this->currentUrlParse['host'])) {
+ // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site
+ $currentHost = Common::mb_strtolower($this->currentUrlParse['host']);
+ if ($currentHost == Common::mb_strtolower($this->referrerHost)) {
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
return true;
}
}
+
return false;
}
diff --git a/plugins/Referrers/Columns/Campaign.php b/plugins/Referrers/Columns/Campaign.php
index ff2d5c2401..c29b622336 100644
--- a/plugins/Referrers/Columns/Campaign.php
+++ b/plugins/Referrers/Columns/Campaign.php
@@ -37,7 +37,7 @@ class Campaign extends Base
/**
* If we should create a new visit when the campaign changes, check if the campaign info changed and if so
- * force the tracker to create a new visit.
+ * force the tracker to create a new visit.i
*
* @param Request $request
* @param Visitor $visitor