diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/DevicePlugins/API.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/DevicePlugins/API.php b/plugins/DevicePlugins/API.php index 21765a981d..b4b33b8db3 100644 --- a/plugins/DevicePlugins/API.php +++ b/plugins/DevicePlugins/API.php @@ -41,18 +41,18 @@ class API extends \Piwik\Plugin\API { // fetch all archive data required $dataTable = $this->getDataTable(Archiver::PLUGIN_RECORD_NAME, $idSite, $period, $date, $segment); - $browserTypes = $this->getDataTable(DDArchiver::BROWSER_ENGINE_RECORD_NAME, $idSite, $period, $date, $segment); + $browserVersions = $this->getDataTable(DDArchiver::BROWSER_VERSION_RECORD_NAME, $idSite, $period, $date, $segment); $archive = Archive::build($idSite, $period, $date, $segment); $visitsSums = $archive->getDataTableFromNumeric('nb_visits'); // check whether given tables are arrays if ($dataTable instanceof DataTable\Map) { $dataTableMap = $dataTable->getDataTables(); - $browserTypesArray = $browserTypes->getDataTables(); + $browserVersionsArray = $browserVersions->getDataTables(); $visitSumsArray = $visitsSums->getDataTables(); } else { $dataTableMap = array($dataTable); - $browserTypesArray = array($browserTypes); + $browserVersionsArray = array($browserVersions); $visitSumsArray = array($visitsSums); } @@ -61,9 +61,18 @@ class API extends \Piwik\Plugin\API // Calculate percentage, but ignore IE users because plugin detection doesn't work on IE $ieVisits = 0; - $ieStats = $browserTypesArray[$key]->getRowFromLabel('Trident'); - if ($ieStats !== false) { - $ieVisits = $ieStats->getColumn(Metrics::INDEX_NB_VISITS); + $browserVersionsToExclude = array( + 'IE;10.0', + 'IE;9.0', + 'IE;8.0', + 'IE;7.0', + 'IE;6.0', + ); + foreach ($browserVersionsToExclude as $browserVersionToExclude) { + $ieStats = $browserVersionsArray[$key]->getRowFromLabel($browserVersionToExclude); + if ($ieStats !== false) { + $ieVisits += $ieStats->getColumn(Metrics::INDEX_NB_VISITS); + } } // get according visitsSum @@ -83,6 +92,7 @@ class API extends \Piwik\Plugin\API $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getPluginsLogo')); $dataTable->queueFilter('ColumnCallbackReplace', array('label', 'ucfirst')); + $dataTable->queueFilter('RangeCheck', array('nb_visits_percentage', 0, 1)); return $dataTable; } |