Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing device detection after upgrade from 2.3.0 to 2.16.0 #9935

Closed
tassoman opened this issue Mar 16, 2016 · 14 comments
Closed

Missing device detection after upgrade from 2.3.0 to 2.16.0 #9935

tassoman opened this issue Mar 16, 2016 · 14 comments
Labels
worksforme The issue cannot be reproduced and things work as intended.

Comments

@tassoman
Copy link
Contributor

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
Copy link
Member

sgiehl commented Mar 16, 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
Copy link
Contributor Author

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

@sgiehl
Copy link
Member

sgiehl commented Mar 16, 2016

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

@tassoman
Copy link
Contributor Author

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
Copy link
Member

sgiehl commented Mar 16, 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
Copy link
Contributor Author

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
Copy link
Member

sgiehl commented Mar 16, 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
Copy link
Contributor Author

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

@sgiehl
Copy link
Member

sgiehl commented Mar 21, 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
Copy link
Contributor Author

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
Copy link
Contributor Author

Diving into code 🏄 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
Copy link
Member

sgiehl commented Mar 22, 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
Copy link
Member

mattab commented Mar 31, 2016

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

@mattab mattab closed this as completed Mar 31, 2016
@mattab mattab added the worksforme The issue cannot be reproduced and things work as intended. label Mar 31, 2016
@tassoman
Copy link
Contributor Author

tassoman commented Apr 5, 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:

<?php

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;
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants