@tassoman opened this issue on March 16th 2016

Hi there, we just did a Piwik jump from 2.3.0 to 2.16.0 version, now we're missing stats we stored about Mobile Vs Desktop devices during 2.3.0.

We figured out that since version 2.10.0 change-log announced MobileVsDesktop feature was deprecated.

We suppose that since 2.14.1 Mobile Vs Desktop has gone definitively in favor of Device Detector and we missed its "translation" support.

Do we need to repeat the entire upgrade process, jumping from 2.3.0 to 2.14.1 and finally to 2.16.0? Or do we need more steps?

@sgiehl commented on March 16th 2016

The mentioned report isn't available anymore. Instead you should have a report about the device types.

Example on demo: http://demo.piwik.org/index.php?module=CoreHome&action=index&idSite=7&period=day&date=yesterday#?module=DevicesDetection&action=devices&idSite=7&period=day&date=yesterday

@tassoman commented on March 16th 2016

Hello @sgiehl thank you for your fast reply, that report it's empty on our installation. During upgrade, log didn't shown any error.

@sgiehl commented on March 16th 2016

Is it also empty for a current period? Maybe it is not calculated for older periods

@tassoman commented on March 16th 2016

For the current period we can get type, model, brand and resolution as expected. Because of this we suppose there were a conversion process between 2.10 and 2.14 that we miss. So Now we have the old's report data not fitted to the new device detector report. My question is about doing a mid-jump to get old Mobile Vs Desktops reports converted in Device Detector using a Piwik version were not yet removed. Is it?

@sgiehl commented on March 16th 2016

Did you have the DevicesDetectionplugin enabled when running 2.3.0?

If you still have all the log data you could also let piwik rearchive all the data, maybe the reports will get visible then.

@tassoman commented on March 16th 2016

We keep only 45 days of logs because there are about an hundred configured websites. The past data is made of reports, we can't just php console core:archive. I think the only way to get device detection converted from mobile vs desktop should be during the upgrade process but we missed the "grace period" of the old feature.

@sgiehl commented on March 16th 2016

If DevicesDetection plugin was disabled before there won't be any reports you might be able to use. You can have a look at the older archive tables an check if there are any entries for DevicesDetection_types

@tassoman commented on March 18th 2016

Please @sgiehl, can you say in which release Mobile Vs. Desktop statistic has been substituted by the Device Type one?

@sgiehl commented on March 21st 2016

I guess it was 2.10.0. But after an update the old MobileVSDesktop report should be availabe as Device type. There should have been an update script to provide that change.

@tassoman commented on March 22nd 2016

First of all sorry for posting last screenshoot (now I've deleted it). Was a mistake, DeviceDetector plugin wasn't never activated until some days ago my colleague did some tests on plugins.

That plugin was in Beta status while in 2.3.0 so anyone did enabled it. Would be a better practice to automatically enable all core plugins for the future.

So now the problem is we still have data of the MobileVsDesktop type in archive report db tables but they didn't changed To DeviceDetection_types after 1.16.0 upgrade script.

Now I have two roads to follow: - a) review all the update process looking for the missing MobileVsDesktop support then change the past 2y archived reports to detection type - b) build a new plugin that extract old widget's code and shows the last 2y of MobileVsDesktop.

In your opinion what to do? Do you have any idea where to look for the update script that upgrades this kind of data? Maybe in the plugin itself? Is there the archive process pluggable by each plugin?

@tassoman commented on March 22nd 2016

Diving into code :surfer: I found that getMobileVsDesktop api relies on DeviceDetector_type metric since 2.10 as sources said.

I can't find the code who tells to the update scripts how to fetch from userSettings reports and write to DeviceDetector type. Maybe was never written?

@sgiehl commented on March 22nd 2016

The archives should have been renamed from usersettings to devicedetection. See https://github.com/piwik/piwik/blob/master/core/Updates/2.10.0-b5.php

@mattab commented on March 31st 2016

Hi guys, i'm closing, as it's supposed to work.

@tassoman commented on April 5th 2016

Ciao! Yes, is a worksforme because I ended up «MobileVsDesktop» has never been recorded but computed on the fly by a function: getDeviceTypeFromOS($osLabel).

So now I'm writing a Plugin that exposes an API to let OsFamilies get counted as the previous function did. At the end I want to render the result in a Controller and a Widget.

Now I'm stuck in merging old function getDeviceTypeFromOS($osLabel) to DevicesDetection's getOsFamilies()

I publish my code in this issue in hope to get helped somehow, that's what I've written in my APIs until now:


namespace Piwik\Plugins\RerMobileVsDesktop;

use Piwik\Container\StaticContainer;
use Piwik\DataTable;
use Piwik\Plugins\DevicesDetection\API as ddAPI;

 * API for plugin RerMobileVsDesktop
 * @method static \Piwik\Plugins\RerMobileVsDesktop\API getInstance()
class API extends \Piwik\Plugin\API
    private $logger;

    public function __construct()
        $this->logger = StaticContainer::getContainer()->get('Psr\Log\LoggerInterface');

    public function oldApiMobileVsDesktop($idSite, $period, $date, $segment = false)
        $ddOsFamilies = ddAPI::getInstance()->getOsFamilies($idSite, $period, $date, $segment);

        foreach ($ddOsFamilies->getRows() as $row)
            $os = $row->getColumn('label');
            $visits = $row->getColumn('nb_visits');
            $this->logger->debug('«{os}» {vis} visits.',
                [ 'os' => $os, 'vis' => $visits]

        //Dummy Output missing real visits, placeholders are random int
        $table = DataTable::makeFromSimpleArray([
            array('label' => 'Desktop', 'nb_visits' => rand(0,9)),
            array('label' => 'Mobile', 'nb_visits' => rand(10,99)),
            array('label' => 'Unknown', 'nb_visits' => rand(100, 999)),

        return $table;

This issue was closed on March 31st 2016
Powered by GitHub Issue Mirror