Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GetUsers.php « Reports « UserId « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8abf20a33a896cfd05b83f545c648b497cb66f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

namespace Piwik\Plugins\UserId\Reports;

use Piwik\Piwik;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
use Piwik\Plugins\UserId\Columns\UserId;

/**
 * A report showing all unique user IDs and some aggregated information about them. It also allows
 * to open a popover with visitor details
 */
class GetUsers extends Base
{
    protected function init()
    {
        parent::init();

        $this->name = Piwik::translate('UserId_UserReportTitle');
        $this->subcategoryId = 'UserId_UserReportTitle';
        $this->documentation = Piwik::translate('UserId_UserReportDocumentation');
        $this->dimension = new UserId();
        $this->metrics = array('label', 'nb_visits', 'nb_actions', 'nb_visits_converted');
        $this->supportsFlatten = false;

        // This defines in which order your report appears in the mobile app, in the menu and in the list of widgets
        $this->order = 9;
    }

    /**
     * @return array
     */
    public static function getColumnsToDisplay()
    {
        return array();
    }

    /**
     * @param ViewDataTable $view
     */
    public function configureView(ViewDataTable $view)
    {
        $view->config->addTranslation('label', Piwik::translate('General_UserId'));
        $view->config->addTranslation('nb_visits_converted', Piwik::translate('General_VisitConvertedGoal'));

        /*
         * Hide most of the table footer actions, leaving only export icons and pagination
         */
        $view->config->columns_to_display = $this->metrics;
        $view->config->show_all_views_icons = false;
        $view->config->show_active_view_icon = false;
        $view->config->show_related_reports = false;
        $view->config->show_insights = false;
        $view->config->show_pivot_by_subtable = false;
        $view->config->no_data_message = Piwik::translate('CoreHome_ThereIsNoDataForThisReport') . '<br><br>'
          . sprintf(Piwik::translate('UserId_ThereIsNoDataForThisReportHelp'),
            "<a target='_blank' rel='noreferrer noopener' href='https://matomo.org/docs/user-id/'>", "</a>");

        if ($view->isViewDataTableId(HtmlTable::ID)) {
            $view->config->disable_row_evolution = false;
        }

        // exclude users with less then 2 visits, when low population filter is active
        $view->requestConfig->filter_excludelowpop_value = 2;
    }
}