blob: 62550437685ca02531c491d33c1917edcc6918a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Referrers\Columns;
use Piwik\Common;
use Piwik\Piwik;
use Piwik\Tracker\Action;
use Piwik\Tracker\Request;
use Piwik\Tracker\TrackerConfig;
use Piwik\Tracker\Visitor;
class Website extends Base
{
protected $type = self::TYPE_TEXT;
protected $nameSingular = 'General_Website';
/**
* Set using the `[Tracker] create_new_visit_when_website_referrer_changes` INI config option.
* If true, will force new visits if the referrer website changes.
*
* @var bool
*/
protected $createNewVisitWhenWebsiteReferrerChanges;
public function __construct()
{
$this->createNewVisitWhenWebsiteReferrerChanges = TrackerConfig::getConfigValue('create_new_visit_when_website_referrer_changes') == 1;
}
public function shouldForceNewVisit(Request $request, Visitor $visitor, Action $action = null)
{
if (!$this->createNewVisitWhenWebsiteReferrerChanges) {
return false;
}
$information = $this->getReferrerInformationFromRequest($request, $visitor);
if ($information['referer_type'] == Common::REFERRER_TYPE_WEBSITE
&& $this->isReferrerInformationNew($visitor, $information)
) {
Common::printDebug("Existing visit detected, but creating new visit because website referrer information is different than last action.");
return true;
}
return false;
}
}
|