PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.14.2
Independent Analytics – WordPress Analytics Plugin v2.14.2
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / IAWP / Tables / Table_Journeys.php
independent-analytics / IAWP / Tables Last commit date
Columns 7 months ago Groups 1 year ago Table.php 6 months ago Table_Campaigns.php 10 months ago Table_Clicks.php 7 months ago Table_Devices.php 7 months ago Table_Geo.php 10 months ago Table_Journeys.php 7 months ago Table_Pages.php 7 months ago Table_Referrers.php 10 months ago
Table_Journeys.php
77 lines
1 <?php
2
3 namespace IAWP\Tables;
4
5 use IAWP\ColumnOptions\Options;
6 use IAWP\ColumnOptions\Plugins\Countries;
7 use IAWP\ColumnOptions\Plugins\DeviceBrowsers;
8 use IAWP\ColumnOptions\Plugins\DeviceTypes;
9 use IAWP\ColumnOptions\Plugins\FormConversions;
10 use IAWP\ColumnOptions\Plugins\LinkPatternConversions;
11 use IAWP\Rows\Filter;
12 use IAWP\Rows\Journeys;
13 use IAWP\Statistics\Journey_Statistics;
14 use IAWP\Tables\Columns\Column;
15 use IAWP\Tables\Groups\Group;
16 use IAWP\Tables\Groups\Groups;
17 /** @internal */
18 class Table_Journeys extends \IAWP\Tables\Table
19 {
20 protected $default_sorting_column = 'created_at';
21 public function id() : string
22 {
23 return 'journeys';
24 }
25 public function allow_downloading() : bool
26 {
27 return \false;
28 }
29 public function get_table_toolbar_markup()
30 {
31 return '';
32 }
33 public function get_table_markup(string $sort_column, string $sort_direction)
34 {
35 return \IAWPSCOPED\iawp_blade()->run('journeys.table', ['table' => $this, 'rows' => [], 'render_skeleton' => \true, 'page_size' => \IAWPSCOPED\iawp()->pagination_page_size()]);
36 }
37 public function get_rendered_template(array $rows, bool $just_rows, string $sort_column, string $sort_direction)
38 {
39 return \IAWPSCOPED\iawp_blade()->run('journeys.rows', ['table' => $this, 'rows' => $rows]);
40 }
41 public function resolve_filter_conflicts(array $filters, string $filter_logic) : array
42 {
43 // Are you back again to make changes or are you doing this for another table?
44 // Consider moving the rules to a configuration object that'll be easier to change and reuse.
45 $columns = \array_map(function (Filter $filter) {
46 return $filter->column();
47 }, $filters);
48 $columns_to_disable = [];
49 if ($filter_logic === 'or' && (\in_array('submitted_form', $columns) || \in_array('clicked_link', $columns) || \in_array('page', $columns))) {
50 if (\in_array('views', $columns)) {
51 $columns_to_disable[] = 'views';
52 }
53 if (\in_array('duration', $columns)) {
54 $columns_to_disable[] = 'duration';
55 }
56 }
57 if (empty($columns_to_disable)) {
58 return $filters;
59 }
60 $modified_filters = \array_values(\array_filter($filters, function (Filter $filter) use($columns_to_disable) {
61 return !\in_array($filter->column(), $columns_to_disable);
62 }));
63 return $modified_filters;
64 }
65 protected function groups() : Groups
66 {
67 $groups = [];
68 $groups[] = new Group('journey', \__('User Journeys', 'independent-analytics'), '', Journeys::class, Journey_Statistics::class);
69 return new Groups($groups);
70 }
71 protected function local_columns() : array
72 {
73 $columns = [new Column(['id' => 'created_at', 'name' => \__('Session Start', 'independent-analytics'), 'type' => 'date', 'visible' => \true, 'is_concrete_column' => \true, 'can_be_filtered' => \false]), new Column(['id' => 'cached_title', 'name' => \__('Landing Page Title', 'independent-analytics'), 'type' => 'string', 'visible' => \true, 'is_concrete_column' => \true]), new Column(['id' => 'page', 'name' => \__('Page Title', 'independent-analytics'), 'type' => 'string', 'visible' => \true, 'separate_filter_column' => 'resources.cached_title', 'is_concrete_column' => \true]), new Column(['id' => 'referrer', 'name' => \__('Referrer', 'independent-analytics'), 'type' => 'string', 'visible' => \true, 'is_concrete_column' => \true, 'separate_database_column' => 'referrer']), new Column(['id' => 'views', 'name' => \__('Views', 'independent-analytics'), 'type' => 'int', 'visible' => \true, 'is_concrete_column' => \false]), new Column(['id' => 'duration', 'name' => \__('Session Duration', 'independent-analytics'), 'type' => 'int', 'visible' => \true, 'is_concrete_column' => \false]), new Column(['id' => 'country', 'name' => \__('Country', 'independent-analytics'), 'visible' => \true, 'type' => 'select', 'options' => new Options(new Countries()), 'separate_filter_column' => 'sessions.country_id', 'is_concrete_column' => \true]), new Column(['id' => 'device_type', 'name' => \__('Device Type', 'independent-analytics'), 'visible' => \true, 'type' => 'select', 'options' => new Options(new DeviceTypes()), 'separate_filter_column' => 'sessions.device_type_id', 'is_concrete_column' => \true]), new Column(['id' => 'device_browser', 'name' => \__('Browser', 'independent-analytics'), 'visible' => \true, 'type' => 'select', 'options' => new Options(new DeviceBrowsers()), 'separate_filter_column' => 'sessions.device_browser_id', 'is_concrete_column' => \true]), new Column(['id' => 'utm_source', 'name' => \__('Source', 'independent-analytics'), 'plugin_group' => 'campaigns', 'visible' => \true, 'type' => 'string', 'is_concrete_column' => \true]), new Column(['id' => 'utm_medium', 'name' => \__('Medium', 'independent-analytics'), 'plugin_group' => 'campaigns', 'visible' => \true, 'type' => 'string', 'is_concrete_column' => \true]), new Column(['id' => 'utm_campaign', 'name' => \__('Campaign', 'independent-analytics'), 'plugin_group' => 'campaigns', 'visible' => \true, 'type' => 'string', 'is_concrete_column' => \true]), new Column(['id' => 'utm_term', 'name' => \__('Term', 'independent-analytics'), 'plugin_group' => 'campaigns', 'type' => 'string', 'is_nullable' => \true, 'is_concrete_column' => \true]), new Column(['id' => 'utm_content', 'name' => \__('Content', 'independent-analytics'), 'plugin_group' => 'campaigns', 'type' => 'string', 'is_nullable' => \true, 'is_concrete_column' => \true]), new Column(['id' => 'submitted_form', 'name' => \__('Form Submission', 'independent-analytics'), 'plugin_group' => 'conversions', 'type' => 'select', 'options' => new Options(new FormConversions()), 'visible' => \true, 'is_concrete_column' => \true, 'separate_filter_column' => 'form_id']), new Column(['id' => 'clicked_link', 'name' => \__('Clicked Link', 'independent-analytics'), 'plugin_group' => 'conversions', 'type' => 'select', 'options' => new Options(new LinkPatternConversions()), 'visible' => \true, 'is_concrete_column' => \true, 'separate_filter_column' => 'clicks.link_rule_id']), new Column(['id' => 'wc_gross_sales', 'name' => \__('Gross Sales', 'independent-analytics'), 'plugin_group' => 'conversions', 'type' => 'int', 'visible' => \true, 'is_concrete_column' => \true])];
74 return $columns;
75 }
76 }
77