PDF rausgenommen
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\DeviceDetectorFactory;
|
||||
use Piwik\Plugin\Dimension\VisitDimension;
|
||||
|
||||
abstract class Base extends VisitDimension
|
||||
{
|
||||
protected function getUAParser($userAgent)
|
||||
{
|
||||
return DeviceDetectorFactory::getInstance($userAgent);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class BrowserEngine extends Base
|
||||
{
|
||||
protected $columnName = 'config_browser_engine';
|
||||
protected $columnType = 'VARCHAR(10) NULL';
|
||||
protected $segmentName = 'browserEngine';
|
||||
protected $nameSingular = 'DevicesDetection_BrowserEngine';
|
||||
protected $namePlural = 'DevicesDetection_BrowserEngines';
|
||||
protected $acceptValues = 'Trident, WebKit, Presto, Gecko, Blink, etc.';
|
||||
protected $suggestedValuesCallback = '\DeviceDetector\Parser\Client\Browser\Engine::getAvailableEngines';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
|
||||
public function formatValue($value, $idSite, Formatter $formatter)
|
||||
{
|
||||
return \Piwik\Plugins\DevicesDetection\getBrowserEngineName($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
$aBrowserInfo = $parser->getClient();
|
||||
|
||||
if (!empty($aBrowserInfo['engine'])) {
|
||||
|
||||
return $aBrowserInfo['engine'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class BrowserName extends Base
|
||||
{
|
||||
protected $columnName = 'config_browser_name';
|
||||
protected $columnType = 'VARCHAR(10) NULL';
|
||||
protected $segmentName = 'browserCode';
|
||||
protected $nameSingular = 'DevicesDetection_ColumnBrowser';
|
||||
protected $namePlural = 'DevicesDetection_Browsers';
|
||||
protected $acceptValues = 'FF, IE, CH, SF, OP, etc.';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
|
||||
public function formatValue($value, $idSite, Formatter $formatter)
|
||||
{
|
||||
return \Piwik\Plugins\DevicesDetection\getBrowserName($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
$aBrowserInfo = $parser->getClient();
|
||||
|
||||
if (!empty($aBrowserInfo['short_name'])) {
|
||||
|
||||
return $aBrowserInfo['short_name'];
|
||||
}
|
||||
|
||||
return 'UNK';
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class BrowserVersion extends Base
|
||||
{
|
||||
protected $columnName = 'config_browser_version';
|
||||
protected $columnType = 'VARCHAR(20) NULL';
|
||||
protected $segmentName = 'browserVersion';
|
||||
protected $nameSingular = 'DevicesDetection_BrowserVersion';
|
||||
protected $namePlural = 'DevicesDetection_BrowserVersions';
|
||||
protected $acceptValues = '1.0, 8.0, etc.';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
$aBrowserInfo = $parser->getClient();
|
||||
|
||||
if (!empty($aBrowserInfo['version'])) {
|
||||
|
||||
return $aBrowserInfo['version'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use DeviceDetector\Parser\Device\DeviceParserAbstract;
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class DeviceBrand extends Base
|
||||
{
|
||||
protected $columnName = 'config_device_brand';
|
||||
protected $columnType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
protected $nameSingular = 'DevicesDetection_DeviceBrand';
|
||||
protected $namePlural = 'DevicesDetection_DeviceBrands';
|
||||
protected $segmentName = 'deviceBrand';
|
||||
|
||||
|
||||
public function formatValue($value, $idSite, Formatter $formatter)
|
||||
{
|
||||
return \Piwik\Plugins\DevicesDetection\getDeviceBrandLabel($value);
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$brands = DeviceParserAbstract::$deviceBrands;
|
||||
natcasesort ($brands);
|
||||
$brandList = implode(", ", $brands);
|
||||
$this->acceptValues = $brandList;
|
||||
|
||||
$this->sqlFilter = function ($brand) use ($brandList, $brands) {
|
||||
if ($brand == Piwik::translate('General_Unknown')) {
|
||||
return '';
|
||||
}
|
||||
$index = array_search(trim(urldecode($brand)), $brands);
|
||||
if ($index === false) {
|
||||
throw new \Exception("deviceBrand segment must be one of: $brandList");
|
||||
}
|
||||
return $index;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
return $parser->getBrand();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
return $visitor->getVisitorColumn($this->columnName);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class DeviceModel extends Base
|
||||
{
|
||||
protected $columnName = 'config_device_model';
|
||||
protected $columnType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
protected $nameSingular = 'DevicesDetection_DeviceModel';
|
||||
protected $namePlural = 'DevicesDetection_DeviceModels';
|
||||
protected $segmentName = 'deviceModel';
|
||||
protected $acceptValues = 'iPad, Nexus 5, Galaxy S5, Fire TV, etc.';
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
$model = $parser->getModel();
|
||||
|
||||
if (!empty($model)) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
$deviceType = $parser->getDeviceName();
|
||||
|
||||
if (!empty($deviceType)) {
|
||||
return 'generic ' . $deviceType;
|
||||
}
|
||||
|
||||
if ($parser->isMobile()) {
|
||||
return 'generic mobile';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
return $visitor->getVisitorColumn($this->columnName);
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Tracker\Request;
|
||||
use Exception;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
use DeviceDetector\Parser\Device\DeviceParserAbstract as DeviceParser;
|
||||
|
||||
class DeviceType extends Base
|
||||
{
|
||||
protected $columnName = 'config_device_type';
|
||||
protected $columnType = 'TINYINT( 100 ) NULL DEFAULT NULL';
|
||||
protected $segmentName = 'deviceType';
|
||||
protected $type = self::TYPE_ENUM;
|
||||
protected $nameSingular = 'DevicesDetection_DeviceType';
|
||||
protected $namePlural = 'DevicesDetection_DeviceTypes';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$deviceTypes = DeviceParser::getAvailableDeviceTypeNames();
|
||||
$deviceTypeList = implode(", ", $deviceTypes);
|
||||
|
||||
$this->acceptValues = $deviceTypeList;
|
||||
}
|
||||
|
||||
public function formatValue($value, $idSite, Formatter $formatter)
|
||||
{
|
||||
return \Piwik\Plugins\DevicesDetection\getDeviceTypeLabel($value);
|
||||
}
|
||||
|
||||
public function getEnumColumnValues()
|
||||
{
|
||||
$values = DeviceParser::getAvailableDeviceTypes();
|
||||
return array_flip($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
return $parser->getDevice();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
return $visitor->getVisitorColumn($this->columnName);
|
||||
}
|
||||
}
|
58
msd2/tracking/piwik/plugins/DevicesDetection/Columns/Os.php
Normal file
58
msd2/tracking/piwik/plugins/DevicesDetection/Columns/Os.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Settings;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class Os extends Base
|
||||
{
|
||||
protected $columnName = 'config_os';
|
||||
protected $columnType = 'CHAR(3) NULL';
|
||||
protected $segmentName = 'operatingSystemCode';
|
||||
protected $nameSingular = 'DevicesDetection_ColumnOperatingSystem';
|
||||
protected $namePlural = 'DevicesDetection_OperatingSystems';
|
||||
protected $acceptValues = 'WIN, MAC, LIN, AND, IPD, etc.';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
|
||||
public function formatValue($value, $idSite, Formatter $formatter)
|
||||
{
|
||||
return \Piwik\Plugins\DevicesDetection\getOSFamilyFullName($value);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return Piwik::translate('DevicesDetection_OperatingSystemFamily');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
if ($parser->isBot()) {
|
||||
$os = Settings::OS_BOT;
|
||||
} else {
|
||||
$os = $parser->getOS();
|
||||
$os = empty($os['short_name']) ? 'UNK' : $os['short_name'];
|
||||
}
|
||||
|
||||
return $os;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\DevicesDetection\Columns;
|
||||
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class OsVersion extends Base
|
||||
{
|
||||
protected $columnName = 'config_os_version';
|
||||
protected $columnType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL';
|
||||
protected $nameSingular = 'DevicesDetection_ColumnOperatingSystemVersion';
|
||||
protected $namePlural = 'DevicesDetection_OperatingSystemVersions';
|
||||
protected $segmentName = 'operatingSystemVersion';
|
||||
protected $acceptValues = 'XP, 7, 2.3, 5.1, ...';
|
||||
protected $type = self::TYPE_TEXT;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
$userAgent = $request->getUserAgent();
|
||||
$parser = $this->getUAParser($userAgent);
|
||||
|
||||
return $parser->getOs('version');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user