blob: 0eacedf1df18cbaeeb003674a96adb5e942d3ad5 (
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
56
57
58
59
60
61
62
63
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Tracker;
use Piwik\Common;
use Piwik\Tracker;
/**
* This class represents a download or an outlink.
* This is a particular type of Action: it has no 'name'
*
*/
class ActionClickUrl extends Action
{
function __construct($type, $url, Request $request)
{
parent::__construct($type, $request);
$this->setActionUrl($url);
}
protected function getActionsToLookup()
{
return array(
// Note: we do not normalize download/oulink URL
'idaction_url' => array($this->getActionUrl(), $this->getActionType())
);
}
function writeDebugInfo()
{
parent::writeDebugInfo();
if (self::detectActionIsOutlinkOnAliasHost($this, $this->request->getIdSite())) {
Common::printDebug("INFO: The outlink URL host is one of the known host for this website. ");
}
}
/**
* Detect whether action is an outlink given host aliases
*
* @param Action $action
* @return bool true if the outlink the visitor clicked on points to one of the known hosts for this website
*/
public static function detectActionIsOutlinkOnAliasHost(Action $action, $idSite)
{
if ($action->getActionType() != Action::TYPE_OUTLINK) {
return false;
}
$decodedActionUrl = $action->getActionUrl();
$actionUrlParsed = @parse_url($decodedActionUrl);
if (!isset($actionUrlParsed['host'])) {
return false;
}
return Visit::isHostKnownAliasHost($actionUrlParsed['host'], $idSite);
}
}
|