-
Notifications
You must be signed in to change notification settings - Fork 12
/
Tracker.php
45 lines (38 loc) · 1.1 KB
/
Tracker.php
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
<?php
/**
* Matomo - 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\AnonymousPiwikUsageMeasurement;
/**
* The default PiwikTracker cannot handle multiple instances to different URLs see
* https://github.com/piwik/piwik-php-tracker/issues/14
*/
class Tracker extends \MatomoTracker
{
private $baseApiUrl;
/**
* The method name is not ideal but want to make sure MatomoTracker won't define such method at some point.
* @param string $baseApiUrl eg 'http://demo-anonymous.matomo.org/matomo.php'
*/
public function setBaseApiUrl($baseApiUrl)
{
$this->baseApiUrl = $baseApiUrl;
}
public function setAnonymousUrl($path = '')
{
$this->setUrl(AnonymousPiwikUsageMeasurement::TRACKING_DOMAIN . $path);
}
/**
* Returns the base URL for the piwik server.
*/
protected function getBaseUrl()
{
if (!empty($this->baseApiUrl)) {
return $this->baseApiUrl;
}
return parent::getBaseUrl();
}
}