PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.15.0
Independent Analytics – WordPress Analytics Plugin v2.15.0
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 6 months ago Groups 1 year ago Table.php 4 days ago Table_Campaigns.php 4 days ago Table_Clicks.php 4 days ago Table_Devices.php 4 days ago Table_Geo.php 4 days ago Table_Journeys.php 4 days ago Table_Pages.php 4 days ago Table_Referrers.php 4 days ago
Table_Journeys.php
81 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 name() : string
26 {
27 return \__('Journeys', 'independent-analytics');
28 }
29 public function allow_downloading() : bool
30 {
31 return \false;
32 }
33 public function get_table_toolbar_markup()
34 {
35 return '';
36 }
37 public function get_table_markup(string $sort_column, string $sort_direction)
38 {
39 return \IAWPSCOPED\iawp_render('journeys.table', ['table' => $this, 'rows' => [], 'render_skeleton' => \true, 'page_size' => \IAWPSCOPED\iawp()->pagination_page_size()]);
40 }
41 public function get_rendered_template(array $rows, bool $just_rows, string $sort_column, string $sort_direction)
42 {
43 return \IAWPSCOPED\iawp_render('journeys.rows', ['table' => $this, 'rows' => $rows]);
44 }
45 public function resolve_filter_conflicts(array $filters, string $filter_logic) : array
46 {
47 // Are you back again to make changes or are you doing this for another table?
48 // Consider moving the rules to a configuration object that'll be easier to change and reuse.
49 $columns = \array_map(function (Filter $filter) {
50 return $filter->column();
51 }, $filters);
52 $columns_to_disable = [];
53 if ($filter_logic === 'or' && (\in_array('submitted_form', $columns) || \in_array('clicked_link', $columns) || \in_array('page', $columns))) {
54 if (\in_array('views', $columns)) {
55 $columns_to_disable[] = 'views';
56 }
57 if (\in_array('duration', $columns)) {
58 $columns_to_disable[] = 'duration';
59 }
60 }
61 if (empty($columns_to_disable)) {
62 return $filters;
63 }
64 $modified_filters = \array_values(\array_filter($filters, function (Filter $filter) use($columns_to_disable) {
65 return !\in_array($filter->column(), $columns_to_disable);
66 }));
67 return $modified_filters;
68 }
69 public function groups() : Groups
70 {
71 $groups = [];
72 $groups[] = new Group('journey', \__('User Journeys', 'independent-analytics'), '', Journeys::class, Journey_Statistics::class);
73 return new Groups($groups);
74 }
75 protected function local_columns() : array
76 {
77 $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, 'separate_filter_column' => 'initial_resources.cached_title']), new Column(['id' => 'landing_page_url', 'name' => \__('Landing Page URL', 'independent-analytics'), 'type' => 'string', 'visible' => \true, 'is_concrete_column' => \true, 'separate_filter_column' => 'initial_resources.cached_url']), 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' => 'page_url', 'name' => \__('Page URL', 'independent-analytics'), 'type' => 'string', 'visible' => \true, 'is_concrete_column' => \true, 'separate_filter_column' => 'resources.cached_url']), 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, 'aggregatable' => \true])];
78 return $columns;
79 }
80 }
81