diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-03-18 06:39:17 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-03-18 06:39:17 +0300 |
commit | 107fe4d29728b28f7ca6e363ad0508270faa3bd8 (patch) | |
tree | a454f162cd4cfdf622d2017762c8a817c2bba7ce /plugins/DevicePlugins | |
parent | 74f0d0ff2529aed1ce07bb2409ea204c9cadd99c (diff) |
#7437 Exclude all IE versions except 11 to calculate percentages of plugins
In piwik.js we exclude IE browsers by using the `MSIE` string in the user agent. However IE11 doesn't use that user agent anymore, which means we record plugin usage for IE11, which lead to % > 100%. Now we exclude only IE6, 7, 8, 9, 10.
Diffstat (limited to 'plugins/DevicePlugins')
-rw-r--r-- | plugins/DevicePlugins/API.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/plugins/DevicePlugins/API.php b/plugins/DevicePlugins/API.php index 21765a981d..04f2668739 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 |