Coverage index

src/Hook/ViewsHooks.php

Lines: 100.00%

LineHitsSource
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Drupal\visitors\Hook;
6
7
use Drupal\Core\Config\ConfigFactoryInterface;
8
use Drupal\Core\Entity\ContentEntityInterface;
9
use Drupal\Core\Entity\EntityTypeManagerInterface;
10
use Drupal\Core\Hook\Attribute\Hook;
11
use Drupal\Core\StringTranslation\StringTranslationTrait;
12
use Drupal\Core\StringTranslation\TranslationInterface;
13
14
/**
15
 * Implements hook_views_data().
16
 */
17
class ViewsHooks {
18
  use StringTranslationTrait;
19
20
  /**
21
   * Constructs a ViewsHooks object.
22
   *
23
   * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
24
   *   The config factory.
25
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
26
   *   The entity type manager.
27
   * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
28
   *   The string translation service.
29
   */
30
  public function __construct(
31
    protected ConfigFactoryInterface $configFactory,
32
    protected EntityTypeManagerInterface $entityTypeManager,
33
    TranslationInterface $translation,
34
  ) {
3518
    $this->setStringTranslation($translation);
36
  }
37
38
  /**
39
   * Implements hook_views_data().
40
   */
41
  #[Hook('views_data')]
42
  public function viewsData() {
4318
    $data = [];
4418
    $data['visitors_counter']['table']['group'] = $this->t('Visitors');
4518
    $data['visitors_counter']['table']['base'] = [
4618
      'title' => $this->t('Visitors Entity Counter'),
4718
      'help' => $this->t('Visitors data from visitors DB table.'),
4818
    ];
4918
    $settings = $this->configFactory->get('visitors.settings');
5018
    $supported_entity_types = $settings->get('counter.entity_types') ?? [];
5118
    foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
5218
      $base_table = $entity_type->getBaseTable();
5318
      if (!in_array($entity_type_id, $supported_entity_types) || !$entity_type->entityClassImplements(ContentEntityInterface::class) || !$base_table) {
54
        continue;
55
      }
561
      $base_table = $entity_type->getDataTable() ?: $base_table;
571
      $args = [
581
        '@entity_type' => $entity_type_id,
591
      ];
60
      // Multilingual properties are stored in data table.
611
      if (!$table = $entity_type->getDataTable()) {
621
        $table = $entity_type->getBaseTable();
63
      }
641
      $data[$base_table]['visitors_counter'] = [
651
        'title' => $this->t('Visitors @entity_type counter', $args),
661
        'help' => $this->t('Relate all visitor counts on the @entity_type.', $args),
671
        'relationship' => [
681
          'group' => $this->t('Visitor Counters'),
691
          'label' => $this->t('Visitor counters'),
701
          'base' => 'visitors_counter',
711
          'base field' => 'entity_id',
721
          'relationship field' => $entity_type->getKey('id'),
731
          'id' => 'standard',
741
          'extra' => [
751
            [
761
              'field' => 'entity_type',
771
              'value' => $entity_type_id,
781
            ],
791
          ],
801
        ],
811
      ];
821
      $data['visitors_counter']['table']['join'][$table] = [
831
        'type' => 'LEFT',
841
        'left_field' => $entity_type->getKey('id'),
851
        'field' => 'entity_id',
861
        'extra' => [
871
          [
881
            'field' => 'entity_type',
891
            'value' => $entity_type_id,
901
          ],
911
        ],
921
      ];
93
    }
9418
    $data['visitors_counter']['total'] = [
9518
      'title' => $this->t('Total views'),
9618
      'help' => $this->t('The total number of times the node has been viewed.'),
9718
      'field' => [
9818
        'id' => 'visitors_numeric',
9918
        'click sortable' => TRUE,
10018
      ],
10118
      'filter' => [
10218
        'id' => 'numeric',
10318
      ],
10418
      'argument' => [
10518
        'id' => 'numeric',
10618
      ],
10718
      'sort' => [
10818
        'id' => 'standard',
10918
      ],
11018
    ];
11118
    $data['visitors_counter']['today'] = [
11218
      'title' => $this->t('Views today'),
11318
      'help' => $this->t('The total number of times the node has been viewed today.'),
11418
      'field' => [
11518
        'id' => 'visitors_numeric',
11618
        'click sortable' => TRUE,
11718
      ],
11818
      'filter' => [
11918
        'id' => 'numeric',
12018
      ],
12118
      'argument' => [
12218
        'id' => 'numeric',
12318
      ],
12418
      'sort' => [
12518
        'id' => 'standard',
12618
      ],
12718
    ];
12818
    $data['visitors_counter']['timestamp'] = [
12918
      'title' => $this->t('Most recent visit'),
13018
      'help' => $this->t('The most recent time the node has been viewed.'),
13118
      'field' => [
13218
        'id' => 'visitors_counter_timestamp',
13318
        'click sortable' => TRUE,
13418
      ],
13518
      'filter' => [
13618
        'id' => 'date',
13718
      ],
13818
      'argument' => [
13918
        'id' => 'date',
14018
      ],
14118
      'sort' => [
14218
        'id' => 'standard',
14318
      ],
14418
    ];
14518
    $data['visitors_visit']['table']['group'] = $this->t('Visitors');
14618
    $data['visitors_visit']['table']['base'] = [
14718
      'title' => $this->t('Visitors'),
14818
      'help' => $this->t('Visitors data from visitors DB table.'),
14918
    ];
15018
    $data['visitors_visit']['id'] = [
15118
      'title' => $this->t('Visit ID'),
15218
      'help' => $this->t('Visitors visit ID.'),
15318
      'field' => [
15418
        'id' => 'numeric',
15518
      ],
15618
      'relationship' => [
15718
        'title' => $this->t('Visitors Log'),
15818
        'help' => $this->t('Log of the visitors entry.'),
15918
        'base' => 'visitors_event',
16018
        'base field' => 'visit_id',
16118
        'id' => 'standard',
16218
      ],
16318
      'sort' => [
16418
        'id' => 'standard',
16518
      ],
16618
      'filter' => [
16718
        'id' => 'numeric',
16818
      ],
16918
      'argument' => [
17018
        'id' => 'numeric',
17118
      ],
17218
    ];
17318
    $data['visitors_visit']['visitor_id'] = [
17418
      'title' => $this->t('Unique visitor'),
17518
      'help' => $this->t('A unique ID for the visitor.'),
17618
      'field' => [
17718
        'id' => 'standard',
17818
      ],
17918
      'filter' => [
18018
        'id' => 'string',
18118
      ],
18218
      'sort' => [
18318
        'id' => 'standard',
18418
      ],
18518
      'argument' => [
18618
        'id' => 'string',
18718
      ],
18818
    ];
18918
    $data['visitors_visit']['uid'] = [
19018
      'title' => $this->t('Visit User'),
19118
      'help' => $this->t('The user Id of the Visit.'),
19218
      'field' => [
19318
        'id' => 'standard',
19418
      ],
19518
      'relationship' => [
19618
        'title' => $this->t('User'),
19718
        'help' => $this->t('Relate visitor data to the user entity.'),
19818
        'base' => 'users_field_data',
19918
        'base field' => 'uid',
20018
        'id' => 'standard',
20118
      ],
20218
      'filter' => [
20318
        'id' => 'string',
20418
      ],
20518
      'argument' => [
20618
        'id' => 'string',
20718
      ],
20818
    ];
20918
    $data['visitors_visit']['localtime'] = [
21018
      'title' => $this->t('Visitor Hour'),
21118
      'help' => $this->t('The hour (client) of the visit.'),
21218
      'field' => [
21318
        'id' => 'visitors_local_hour',
21418
        'field' => 'localtime',
21518
      ],
21618
    ];
21718
    $data['visitors_visit']['returning'] = [
21818
      'title' => $this->t('Returning Visitor'),
21918
      'help' => $this->t('Indicates whether the visitor is a returning visitor.'),
22018
      'field' => [
22118
        'id' => 'boolean',
22218
      ],
22318
      'filter' => [
22418
        'id' => 'boolean',
225
              // Optional: allows filtering on NULL values.
22618
        'allow empty' => TRUE,
22718
      ],
22818
      'argument' => [
22918
        'id' => 'boolean',
23018
      ],
23118
    ];
23218
    $data['visitors_visit']['total_visits'] = [
23318
      'title' => $this->t('Total Visits'),
23418
      'help' => $this->t('Total visits.'),
23518
      'field' => [
23618
        'id' => 'visitors_number_range',
23718
      ],
23818
      'sort' => [
23918
        'id' => 'visitors_number_range',
24018
      ],
24118
      'filter' => [
24218
        'id' => 'numeric',
24318
      ],
24418
      'argument' => [
24518
        'id' => 'numeric',
24618
      ],
24718
    ];
24818
    $data['visitors_visit']['total_page_views'] = [
24918
      'title' => $this->t('Total Page Views'),
25018
      'help' => $this->t('The number of pages viewed in the visit.'),
25118
      'field' => [
25218
        'id' => 'visitors_number_range',
25318
      ],
25418
      'sort' => [
25518
        'id' => 'visitors_number_range',
25618
      ],
25718
      'filter' => [
25818
        'id' => 'numeric',
25918
      ],
26018
      'argument' => [
26118
        'id' => 'numeric',
26218
      ],
26318
    ];
26418
    $data['visitors_visit']['total_events'] = [
26518
      'title' => $this->t('Total Events'),
26618
      'help' => $this->t('The number of events in the visit.'),
26718
      'field' => [
26818
        'id' => 'visitors_number_range',
26918
      ],
27018
      'sort' => [
27118
        'id' => 'visitors_number_range',
27218
      ],
27318
      'filter' => [
27418
        'id' => 'numeric',
27518
      ],
27618
      'argument' => [
27718
        'id' => 'numeric',
27818
      ],
27918
    ];
28018
    $data['visitors_visit']['bounce'] = [
28118
      'title' => $this->t('Bounce'),
28218
      'help' => $this->t('The visit is a bounce.'),
28318
      'field' => [
28418
        'id' => 'visitors_bounce',
28518
      ],
28618
      'sort' => [
28718
        'id' => 'visitors_bounce_rate',
28818
      ],
28918
      'filter' => [
29018
        'id' => 'boolean',
29118
      ],
29218
      'argument' => [
29318
        'id' => 'boolean',
29418
      ],
29518
    ];
29618
    $data['visitors_visit']['bounce_rate'] = [
29718
      'title' => $this->t('Bounce Rate'),
29818
      'help' => $this->t('The bounce rate of the visit.'),
29918
      'field' => [
30018
        'id' => 'visitors_bounce_rate',
30118
        'field' => 'total_events',
30218
      ],
30318
      'sort' => [
30418
        'id' => 'visitors_bounce_rate',
30518
      ],
30618
      'filter' => [
30718
        'id' => 'numeric',
30818
      ],
30918
      'argument' => [
31018
        'id' => 'numeric',
31118
      ],
31218
    ];
31318
    $data['visitors_visit']['total_time'] = [
31418
      'title' => $this->t('Total Time'),
31518
      'help' => $this->t('The total time of the visit.'),
31618
      'field' => [
31718
        'id' => 'visitors_number_range',
31818
      ],
31918
      'sort' => [
32018
        'id' => 'visitors_number_range',
32118
      ],
32218
      'filter' => [
32318
        'id' => 'numeric',
32418
      ],
32518
      'argument' => [
32618
        'id' => 'numeric',
32718
      ],
32818
    ];
32918
    $data['visitors_visit']['entry'] = [
33018
      'title' => $this->t('Entry page'),
33118
      'help' => $this->t('The first page viewed in the visit.'),
33218
      'field' => [
33318
        'id' => 'numeric',
33418
      ],
33518
      'relationship' => [
33618
        'title' => $this->t('Entry page'),
33718
        'help' => $this->t('Page view Log.'),
33818
        'base' => 'visitors_event',
33918
        'base field' => 'id',
34018
        'id' => 'standard',
34118
      ],
34218
      'sort' => [
34318
        'id' => 'standard',
34418
      ],
34518
      'filter' => [
34618
        'id' => 'numeric',
34718
      ],
34818
      'argument' => [
34918
        'id' => 'numeric',
35018
      ],
35118
    ];
35218
    $data['visitors_visit']['entry_time'] = [
35318
      'title' => $this->t('Entry Time'),
35418
      'help' => $this->t('The timestamp of the page view.'),
35518
      'field' => [
35618
        'id' => 'date',
35718
        'click sortable' => TRUE,
35818
      ],
35918
    ];
36018
    $data['visitors_visit']['exit'] = [
36118
      'title' => $this->t('Exit page'),
36218
      'help' => $this->t('The last page viewed in the visit.'),
36318
      'field' => [
36418
        'id' => 'numeric',
36518
      ],
36618
      'relationship' => [
36718
        'title' => $this->t('Exit page'),
36818
        'help' => $this->t('Exit Page view.'),
36918
        'base' => 'visitors_event',
37018
        'base field' => 'id',
37118
        'id' => 'standard',
37218
      ],
37318
      'sort' => [
37418
        'id' => 'standard',
37518
      ],
37618
      'filter' => [
37718
        'id' => 'numeric',
37818
      ],
37918
      'argument' => [
38018
        'id' => 'numeric',
38118
      ],
38218
    ];
38318
    $data['visitors_visit']['exit_time'] = [
38418
      'title' => $this->t('Exit Time'),
38518
      'help' => $this->t('The timestamp of the page view.'),
38618
      'field' => [
38718
        'id' => 'date',
38818
        'click sortable' => TRUE,
38918
      ],
39018
      'sort' => [
39118
        'id' => 'standard',
39218
      ],
39318
    ];
39418
    $data['visitors_visit']['time_since_first'] = [
39518
      'title' => $this->t('Time Since First Visit'),
39618
      'help' => $this->t("Seconds since the visitor's first visit."),
39718
      'field' => [
39818
        'id' => 'visitors_number_range',
39918
        'click sortable' => TRUE,
40018
      ],
40118
      'sort' => [
40218
        'id' => 'visitors_number_range',
40318
      ],
40418
      'filter' => [
40518
        'id' => 'standard',
40618
      ],
40718
      'argument' => [
40818
        'id' => 'numeric',
40918
      ],
41018
    ];
41118
    $data['visitors_visit']['time_since_last'] = [
41218
      'title' => $this->t('Time Since Last Visit'),
41318
      'help' => $this->t("Seconds since the visitor's last visit."),
41418
      'field' => [
41518
        'id' => 'visitors_number_range',
41618
        'click sortable' => TRUE,
41718
      ],
41818
      'sort' => [
41918
        'id' => 'visitors_number_range',
42018
      ],
42118
      'filter' => [
42218
        'id' => 'standard',
42318
      ],
42418
      'argument' => [
42518
        'id' => 'numeric',
42618
      ],
42718
    ];
42818
    $data['visitors_visit']['visit_time'] = [
42918
      'title' => $this->t('Visit Time'),
43018
      'help' => $this->t('Visit time filter.'),
43118
      'filter' => [
43218
        'id' => 'visitors_visit_date',
43318
        'field' => 'exit_time',
43418
      ],
43518
    ];
43618
    $data['visitors_visit']['config_id'] = [
43718
      'title' => $this->t('Config Id'),
43818
      'help' => $this->t('Visitor config hash.'),
43918
      'field' => [
44018
        'id' => 'standard',
44118
      ],
44218
      'filter' => [
44318
        'id' => 'string',
44418
      ],
44518
      'sort' => [
44618
        'id' => 'standard',
44718
      ],
44818
      'argument' => [
44918
        'id' => 'string',
45018
      ],
45118
    ];
45218
    $data['visitors_visit']['config_resolution'] = [
45318
      'title' => $this->t('Resolution'),
45418
      'help' => $this->t("The visitor's screen resolution."),
45518
      'field' => [
45618
        'id' => 'standard',
45718
      ],
45818
      'filter' => [
45918
        'id' => 'string',
46018
      ],
46118
      'argument' => [
46218
        'id' => 'string',
46318
      ],
46418
    ];
46518
    $data['visitors_visit']['config_pdf'] = [
46618
      'title' => $this->t('PDF Plugin'),
46718
      'help' => $this->t("The visitor's browser supports PDFs."),
46818
      'field' => [
46918
        'id' => 'visitors_pdf',
47018
      ],
47118
      'filter' => [
47218
        'id' => 'boolean',
47318
      ],
47418
    ];
47518
    $data['visitors_visit']['config_flash'] = [
47618
      'title' => $this->t('Flash Plugin'),
47718
      'help' => $this->t("The visitor's browser supports Flash."),
47818
      'field' => [
47918
        'id' => 'visitors_flash',
48018
      ],
48118
      'filter' => [
48218
        'id' => 'boolean',
48318
      ],
48418
    ];
48518
    $data['visitors_visit']['config_java'] = [
48618
      'title' => $this->t('Java Plugin'),
48718
      'help' => $this->t("The visitor's browser supports Java."),
48818
      'field' => [
48918
        'id' => 'visitors_java',
49018
      ],
49118
      'filter' => [
49218
        'id' => 'boolean',
49318
      ],
49418
    ];
49518
    $data['visitors_visit']['config_quicktime'] = [
49618
      'title' => $this->t('Quicktime Plugin'),
49718
      'help' => $this->t("The visitor's browser supports Quicktime."),
49818
      'field' => [
49918
        'id' => 'visitors_quicktime',
50018
      ],
50118
      'filter' => [
50218
        'id' => 'boolean',
50318
      ],
50418
    ];
50518
    $data['visitors_visit']['config_realplayer'] = [
50618
      'title' => $this->t('Realplayer Plugin'),
50718
      'help' => $this->t("The visitor's browser supports Realplayer."),
50818
      'field' => [
50918
        'id' => 'visitors_realplayer',
51018
      ],
51118
      'filter' => [
51218
        'id' => 'boolean',
51318
      ],
51418
    ];
51518
    $data['visitors_visit']['config_windowsmedia'] = [
51618
      'title' => $this->t('Windows Media Plugin'),
51718
      'help' => $this->t("The visitor's browser supports Windows Media."),
51818
      'field' => [
51918
        'id' => 'visitors_windowsmedia',
52018
      ],
52118
      'filter' => [
52218
        'id' => 'boolean',
52318
      ],
52418
    ];
52518
    $data['visitors_visit']['config_silverlight'] = [
52618
      'title' => $this->t('Silverlight Plugin'),
52718
      'help' => $this->t("The visitor's browser supports Silverlight."),
52818
      'field' => [
52918
        'id' => 'visitors_silverlight',
53018
      ],
53118
      'filter' => [
53218
        'id' => 'boolean',
53318
      ],
53418
    ];
53518
    $data['visitors_visit']['config_cookie'] = [
53618
      'title' => $this->t('Cookie Plugin'),
53718
      'help' => $this->t("The visitor's browser supports cookies."),
53818
      'field' => [
53918
        'id' => 'visitors_cookie',
54018
      ],
54118
      'filter' => [
54218
        'id' => 'boolean',
54318
      ],
54418
    ];
54518
    $data['visitors_visit']['config_browser_engine'] = [
54618
      'title' => $this->t('Browser Engine'),
54718
      'help' => $this->t('The engine used by the browser.'),
54818
      'field' => [
54918
        'id' => 'standard',
55018
      ],
55118
      'filter' => [
55218
        'id' => 'string',
55318
      ],
55418
      'argument' => [
55518
        'id' => 'string',
55618
      ],
55718
    ];
55818
    $data['visitors_visit']['config_browser_name'] = [
55918
      'title' => $this->t('Browser Name'),
56018
      'help' => $this->t('The name of the browser.'),
56118
      'field' => [
56218
        'id' => 'visitors_browser',
56318
      ],
56418
      'filter' => [
56518
        'id' => 'string',
56618
      ],
56718
      'argument' => [
56818
        'id' => 'string',
56918
      ],
57018
    ];
57118
    $data['visitors_visit']['config_browser_version'] = [
57218
      'title' => $this->t('Browser Version'),
57318
      'help' => $this->t('The version of the browser.'),
57418
      'field' => [
57518
        'id' => 'standard',
57618
      ],
57718
      'filter' => [
57818
        'id' => 'string',
57918
      ],
58018
      'argument' => [
58118
        'id' => 'string',
58218
      ],
58318
    ];
58418
    $data['visitors_visit']['config_client_type'] = [
58518
      'title' => $this->t('Client type'),
58618
      'help' => $this->t('The type of the client.'),
58718
      'field' => [
58818
        'id' => 'standard',
58918
      ],
59018
      'filter' => [
59118
        'id' => 'string',
59218
      ],
59318
      'argument' => [
59418
        'id' => 'string',
59518
      ],
59618
    ];
59718
    $data['visitors_visit']['config_device_brand'] = [
59818
      'title' => $this->t('Device brand'),
59918
      'help' => $this->t('The brand of the device.'),
60018
      'field' => [
60118
        'id' => 'visitors_brand',
60218
      ],
60318
      'filter' => [
60418
        'id' => 'string',
60518
      ],
60618
      'argument' => [
60718
        'id' => 'string',
60818
      ],
60918
    ];
61018
    $data['visitors_visit']['config_device_model'] = [
61118
      'title' => $this->t('Device model'),
61218
      'help' => $this->t('The model of the device.'),
61318
      'field' => [
61418
        'id' => 'standard',
61518
      ],
61618
      'filter' => [
61718
        'id' => 'string',
61818
      ],
61918
      'argument' => [
62018
        'id' => 'string',
62118
      ],
62218
    ];
62318
    $data['visitors_visit']['config_device_type'] = [
62418
      'title' => $this->t('Device type'),
62518
      'help' => $this->t('The type of device.'),
62618
      'field' => [
62718
        'id' => 'visitors_device',
62818
      ],
62918
      'filter' => [
63018
        'id' => 'string',
63118
      ],
63218
      'argument' => [
63318
        'id' => 'string',
63418
      ],
63518
    ];
63618
    $data['visitors_visit']['config_os'] = [
63718
      'title' => $this->t('Operating System'),
63818
      'help' => $this->t('The operating system.'),
63918
      'field' => [
64018
        'id' => 'visitors_operating_system',
64118
      ],
64218
      'filter' => [
64318
        'id' => 'string',
64418
      ],
64518
      'argument' => [
64618
        'id' => 'string',
64718
      ],
64818
    ];
64918
    $data['visitors_visit']['config_os_version'] = [
65018
      'title' => $this->t('OS version'),
65118
      'help' => $this->t('The version of the Operating System.'),
65218
      'field' => [
65318
        'id' => 'standard',
65418
      ],
65518
      'filter' => [
65618
        'id' => 'string',
65718
      ],
65818
      'argument' => [
65918
        'id' => 'string',
66018
      ],
66118
    ];
66218
    $data['visitors_visit']['bot'] = [
66318
      'title' => $this->t('Bot'),
66418
      'help' => $this->t("The visit is from a bot."),
66518
      'field' => [
66618
        'id' => 'boolean',
66718
      ],
66818
      'filter' => [
66918
        'id' => 'boolean',
67018
      ],
67118
      'argument' => [
67218
        'id' => 'numeric',
67318
      ],
67418
    ];
67518
    $data['visitors_visit']['ai_agent'] = [
67618
      'title' => $this->t('AI agent'),
67718
      'help' => $this->t('The visit was opened by an AI agent browser.'),
67818
      'field' => [
67918
        'id' => 'boolean',
68018
      ],
68118
      'filter' => [
68218
        'id' => 'boolean',
68318
      ],
68418
      'sort' => [
68518
        'id' => 'standard',
68618
      ],
68718
      'argument' => [
68818
        'id' => 'numeric',
68918
      ],
69018
    ];
69118
    $data['visitors_visit']['ai_agent_label'] = [
69218
      'title' => $this->t('Visitor type'),
69318
      'help' => $this->t('Human or AI agent.'),
69418
      'real field' => 'ai_agent',
69518
      'field' => [
69618
        'id' => 'visitors_ai_agent',
69718
      ],
69818
    ];
69918
    $data['visitors_visit']['bot_name'] = [
70018
      'title' => $this->t('Bot name'),
70118
      'help' => $this->t('The Device Detector name of the bot.'),
70218
      'field' => [
70318
        'id' => 'standard',
70418
      ],
70518
      'filter' => [
70618
        'id' => 'string',
70718
      ],
70818
      'argument' => [
70918
        'id' => 'string',
71018
      ],
71118
    ];
71218
    $data['visitors_visit']['location_browser_lang'] = [
71318
      'title' => $this->t('Language'),
71418
      'help' => $this->t('The browser language.'),
71518
      'field' => [
71618
        'id' => 'visitors_language',
71718
      ],
71818
      'filter' => [
71918
        'id' => 'string',
72018
      ],
72118
      'argument' => [
72218
        'id' => 'string',
72318
      ],
72418
    ];
72518
    $data['visitors_visit']['location_ip'] = [
72618
      'title' => $this->t('Visitors IP'),
72718
      'help' => $this->t('The IP of the visitors entry.'),
72818
      'field' => [
72918
        'id' => 'standard',
73018
      ],
73118
      'filter' => [
73218
        'id' => 'string',
73318
      ],
73418
      'argument' => [
73518
        'id' => 'string',
73618
      ],
73718
    ];
73818
    $data['visitors_visit']['location_continent'] = [
73918
      'title' => $this->t('Continent'),
74018
      'help' => $this->t('The location continent.'),
74118
      'field' => [
74218
        'id' => 'visitors_continent',
74318
      ],
74418
      'filter' => [
74518
        'id' => 'string',
74618
      ],
74718
      'argument' => [
74818
        'id' => 'string',
74918
      ],
75018
    ];
75118
    $data['visitors_visit']['location_country'] = [
75218
      'title' => $this->t('Country'),
75318
      'help' => $this->t('The location country.'),
75418
      'field' => [
75518
        'id' => 'visitors_country',
75618
      ],
75718
      'filter' => [
75818
        'id' => 'string',
75918
      ],
76018
      'argument' => [
76118
        'id' => 'string',
76218
      ],
76318
    ];
76418
    $data['visitors_visit']['location_region'] = [
76518
      'title' => $this->t('Region'),
76618
      'help' => $this->t('The region of the visitor.'),
76718
      'field' => [
76818
        'id' => 'standard',
76918
      ],
77018
      'filter' => [
77118
        'id' => 'string',
77218
      ],
77318
      'argument' => [
77418
        'id' => 'string',
77518
      ],
77618
    ];
77718
    $data['visitors_visit']['location_city'] = [
77818
      'title' => $this->t('City'),
77918
      'help' => $this->t('The city of the visitor.'),
78018
      'field' => [
78118
        'id' => 'standard',
78218
      ],
78318
      'filter' => [
78418
        'id' => 'string',
78518
      ],
78618
      'argument' => [
78718
        'id' => 'string',
78818
      ],
78918
    ];
79018
    $data['visitors_visit']['location_latitude'] = [
79118
      'title' => $this->t('Location Latitude'),
79218
      'help' => $this->t('The latitude derived from the IP address.'),
79318
      'field' => [
79418
        'id' => 'numeric',
79518
      ],
79618
      'filter' => [
79718
        'id' => 'numeric',
79818
      ],
79918
      'sort' => [
80018
        'id' => 'numeric',
80118
      ],
80218
    ];
80318
    $data['visitors_visit']['location_longitude'] = [
80418
      'title' => $this->t('Location Longitude'),
80518
      'help' => $this->t('The longitude derived from the IP address.'),
80618
      'field' => [
80718
        'id' => 'numeric',
80818
      ],
80918
      'filter' => [
81018
        'id' => 'numeric',
81118
      ],
81218
      'sort' => [
81318
        'id' => 'numeric',
81418
      ],
81518
    ];
81618
    $data['visitors_visit']['referer_type'] = [
81718
      'title' => $this->t('Referer Type'),
81818
      'help' => $this->t('The type of the referer.'),
81918
      'field' => [
82018
        'id' => 'standard',
82118
      ],
82218
      'filter' => [
82318
        'id' => 'string',
82418
      ],
82518
    ];
82618
    $data['visitors_visit']['referer_type_link'] = [
82718
      'title' => $this->t('Referer Type'),
82818
      'help' => $this->t('The type of the referer.'),
82918
      'real field' => 'referer_type',
83018
      'field' => [
83118
        'id' => 'visitors_referer_type',
83218
      ],
83318
    ];
83418
    $data['visitors_visit']['referer_name'] = [
83518
      'title' => $this->t('Referer Name'),
83618
      'help' => $this->t('The name of the referer.'),
83718
      'field' => [
83818
        'id' => 'standard',
83918
      ],
84018
      'argument' => [
84118
        'id' => 'string',
84218
      ],
84318
      'filter' => [
84418
        'id' => 'string',
84518
      ],
84618
    ];
84718
    $data['visitors_visit']['referer_name_link'] = [
84818
      'title' => $this->t('Referer Name'),
84918
      'help' => $this->t('The name of the referer.'),
85018
      'real field' => 'referer_name',
85118
      'field' => [
85218
        'id' => 'visitors_referer_name_link',
85318
      ],
85418
    ];
85518
    $data['visitors_visit']['referer_url'] = [
85618
      'title' => $this->t('Referer URL'),
85718
      'help' => $this->t('The URL of the referer.'),
85818
      'field' => [
85918
        'id' => 'standard',
86018
      ],
86118
      'argument' => [
86218
        'id' => 'string',
86318
      ],
86418
      'filter' => [
86518
        'id' => 'string',
86618
      ],
86718
    ];
86818
    $data['visitors_visit']['referer_keyword'] = [
86918
      'title' => $this->t('Referer Keyword'),
87018
      'help' => $this->t('The keyword of the referer.'),
87118
      'field' => [
87218
        'id' => 'standard',
87318
      ],
87418
      'argument' => [
87518
        'id' => 'visitors_referer_keyword',
87618
      ],
87718
      'filter' => [
87818
        'id' => 'string',
87918
        'allow empty' => TRUE,
88018
      ],
88118
    ];
88218
    $data['visitors_visit']['referer_keyword_link'] = [
88318
      'title' => $this->t('Referer Keyword'),
88418
      'help' => $this->t('The keyword of the referer.'),
88518
      'real field' => 'referer_keyword',
88618
      'field' => [
88718
        'id' => 'visitors_referer_name_link',
88818
      ],
88918
    ];
89018
    $data['visitors_visit']['campaign_source'] = [
89118
      'title' => $this->t('Campaign source'),
89218
      'help' => $this->t('The campaign source.'),
89318
      'field' => [
89418
        'id' => 'standard',
89518
      ],
89618
      'argument' => [
89718
        'id' => 'string',
89818
      ],
89918
      'filter' => [
90018
        'id' => 'string',
90118
      ],
90218
    ];
90318
    $data['visitors_visit']['campaign_medium'] = [
90418
      'title' => $this->t('Campaign medium'),
90518
      'help' => $this->t('The campaign medium.'),
90618
      'field' => [
90718
        'id' => 'standard',
90818
      ],
90918
      'argument' => [
91018
        'id' => 'string',
91118
      ],
91218
      'filter' => [
91318
        'id' => 'string',
91418
      ],
91518
    ];
91618
    $data['visitors_visit']['campaign_content'] = [
91718
      'title' => $this->t('Campaign content'),
91818
      'help' => $this->t('The campaign content.'),
91918
      'field' => [
92018
        'id' => 'standard',
92118
      ],
92218
      'argument' => [
92318
        'id' => 'string',
92418
      ],
92518
      'filter' => [
92618
        'id' => 'string',
92718
      ],
92818
    ];
92918
    $data['visitors_visit']['campaign_id'] = [
93018
      'title' => $this->t('Campaign id'),
93118
      'help' => $this->t('The campaign id.'),
93218
      'field' => [
93318
        'id' => 'standard',
93418
      ],
93518
      'argument' => [
93618
        'id' => 'string',
93718
      ],
93818
      'filter' => [
93918
        'id' => 'string',
94018
      ],
94118
    ];
94218
    $data['visitors_visit']['campaign_group'] = [
94318
      'title' => $this->t('Campaign group'),
94418
      'help' => $this->t('The campaign group.'),
94518
      'field' => [
94618
        'id' => 'standard',
94718
      ],
94818
      'argument' => [
94918
        'id' => 'string',
95018
      ],
95118
      'filter' => [
95218
        'id' => 'string',
95318
      ],
95418
    ];
95518
    $data['visitors_visit']['campaign_placement'] = [
95618
      'title' => $this->t('Campaign placement'),
95718
      'help' => $this->t('The campaign placement.'),
95818
      'field' => [
95918
        'id' => 'standard',
96018
      ],
96118
      'argument' => [
96218
        'id' => 'string',
96318
      ],
96418
      'filter' => [
96518
        'id' => 'string',
96618
      ],
96718
    ];
96818
    $data['visitors_event']['table']['group'] = $this->t('Visitors');
96918
    $data['visitors_event']['table']['base'] = [
97018
      'title' => $this->t('Visitors Log'),
97118
      'help' => $this->t('Visitors data from visitors DB table.'),
97218
    ];
97318
    $data['visitors_event']['id'] = [
97418
      'title' => $this->t('Log Id'),
97518
      'help' => $this->t('Visitors Log Id.'),
97618
      'field' => [
97718
        'id' => 'numeric',
97818
      ],
97918
      'sort' => [
98018
        'id' => 'standard',
98118
      ],
98218
      'filter' => [
98318
        'id' => 'numeric',
98418
      ],
98518
      'argument' => [
98618
        'id' => 'numeric',
98718
      ],
98818
    ];
98918
    $data['visitors_event']['exit'] = [
99018
      'title' => $this->t('Exits'),
99118
      'help' => $this->t('Number of visits that ended on this page.'),
99218
      'field' => [
99318
        'id' => 'visitors_exit',
99418
        'click sortable' => TRUE,
99518
      ],
99618
    ];
99718
    $data['visitors_event']['exit_rate'] = [
99818
      'title' => $this->t('Exit rate'),
99918
      'help' => $this->t(
100018
        'The percentage of visits that left the website after viewing this page.'
100118
      ),
100218
      'field' => [
100318
        'id' => 'visitors_exit_rate',
100418
        'click sortable' => TRUE,
100518
      ],
100618
    ];
100718
    $data['visitors_event']['time_spent'] = [
100818
      'title' => $this->t('Time spent'),
100918
      'help' => $this->t('Seconds on this page, or until the next event.'),
101018
      'field' => [
101118
        'id' => 'numeric',
101218
      ],
101318
      'sort' => [
101418
        'id' => 'standard',
101518
      ],
101618
      'filter' => [
101718
        'id' => 'numeric',
101818
      ],
101918
    ];
102018
    $data['visitors_event']['avg_time_on_page'] = [
102118
      'title' => $this->t('Average time on page'),
102218
      'help' => $this->t('Average seconds visitors spent on this page.'),
102318
      'field' => [
102418
        'id' => 'visitors_avg_time_on_page',
102518
        'click sortable' => TRUE,
102618
      ],
102718
    ];
102818
    $data['visitors_event']['unique_pageviews'] = [
102918
      'title' => $this->t('Unique pageviews'),
103018
      'help' => $this->t(
103118
        'Distinct visitors who viewed this page in the filtered period.'
103218
      ),
103318
      'field' => [
103418
        'id' => 'visitors_unique_pageviews',
103518
        'click sortable' => TRUE,
103618
      ],
103718
    ];
103818
    $data['visitors_event']['page_view'] = [
103918
      'title' => $this->t('Event Page View'),
104018
      'help' => $this->t('Visitors Event Page View.'),
104118
      'field' => [
104218
        'id' => 'standard',
104318
      ],
104418
      'sort' => [
104518
        'id' => 'string',
104618
      ],
104718
      'filter' => [
104818
        'id' => 'string',
104918
      ],
105018
      'argument' => [
105118
        'id' => 'string',
105218
      ],
105318
    ];
105418
    $data['visitors_event']['visit_id'] = [
105518
      'title' => $this->t('Event Id'),
105618
      'help' => $this->t('Visitors Event Id.'),
105718
      'field' => [
105818
        'id' => 'numeric',
105918
      ],
106018
      'relationship' => [
106118
        'title' => $this->t('Visitors Visit'),
106218
        'help' => $this->t('Visit of the Log.'),
106318
        'base' => 'visitors_visit',
106418
        'base field' => 'id',
106518
        'id' => 'standard',
106618
      ],
106718
      'sort' => [
106818
        'id' => 'standard',
106918
      ],
107018
      'filter' => [
107118
        'id' => 'numeric',
107218
      ],
107318
      'argument' => [
107418
        'id' => 'numeric',
107518
      ],
107618
    ];
107718
    $data['visitors_event']['event_category'] = [
107818
      'title' => $this->t('Event category'),
107918
      'help' => $this->t('The Matomo event category.'),
108018
      'field' => [
108118
        'id' => 'standard',
108218
      ],
108318
      'sort' => [
108418
        'id' => 'standard',
108518
      ],
108618
      'filter' => [
108718
        'id' => 'string',
108818
      ],
108918
      'argument' => [
109018
        'id' => 'string',
109118
      ],
109218
    ];
109318
    $data['visitors_event']['event_action'] = [
109418
      'title' => $this->t('Event action'),
109518
      'help' => $this->t('The Matomo event action.'),
109618
      'field' => [
109718
        'id' => 'standard',
109818
      ],
109918
      'sort' => [
110018
        'id' => 'standard',
110118
      ],
110218
      'filter' => [
110318
        'id' => 'string',
110418
      ],
110518
      'argument' => [
110618
        'id' => 'string',
110718
      ],
110818
    ];
110918
    $data['visitors_event']['event_name'] = [
111018
      'title' => $this->t('Event name'),
111118
      'help' => $this->t('The Matomo event name.'),
111218
      'field' => [
111318
        'id' => 'standard',
111418
      ],
111518
      'sort' => [
111618
        'id' => 'standard',
111718
      ],
111818
      'filter' => [
111918
        'id' => 'string',
112018
      ],
112118
      'argument' => [
112218
        'id' => 'string',
112318
      ],
112418
    ];
112518
    $data['visitors_event']['event_category_link'] = [
112618
      'title' => $this->t('Event category'),
112718
      'help' => $this->t('The Matomo event category.'),
112818
      'real field' => 'event_category',
112918
      'field' => [
113018
        'id' => 'visitors_referer_name_link',
113118
      ],
113218
    ];
113318
    $data['visitors_event']['event_action_link'] = [
113418
      'title' => $this->t('Event action'),
113518
      'help' => $this->t('The Matomo event action.'),
113618
      'real field' => 'event_action',
113718
      'field' => [
113818
        'id' => 'visitors_event_dimension_link',
113918
      ],
114018
    ];
114118
    $data['visitors_event']['plugin_int_1'] = [
114218
      'title' => $this->t('Search page'),
114318
      'help' => $this->t('The results page of a site search.'),
114418
      'field' => [
114518
        'id' => 'numeric',
114618
      ],
114718
      'sort' => [
114818
        'id' => 'standard',
114918
      ],
115018
      'filter' => [
115118
        'id' => 'numeric',
115218
      ],
115318
    ];
115418
    $data['visitors_event']['plugin_int_2'] = [
115518
      'title' => $this->t('Referrer search page'),
115618
      'help' => $this->t('The results page of the previous site search.'),
115718
      'field' => [
115818
        'id' => 'numeric',
115918
      ],
116018
      'sort' => [
116118
        'id' => 'standard',
116218
      ],
116318
      'filter' => [
116418
        'id' => 'numeric',
116518
      ],
116618
    ];
116718
    $data['visitors_event']['plugin_var_1'] = [
116818
      'title' => $this->t('Search filters'),
116918
      'help' => $this->t('The canonical filter string of a site search.'),
117018
      'field' => [
117118
        'id' => 'standard',
117218
      ],
117318
      'sort' => [
117418
        'id' => 'standard',
117518
      ],
117618
      'filter' => [
117718
        'id' => 'string',
117818
      ],
117918
    ];
118018
    $data['visitors_event']['plugin_var_2'] = [
118118
      'title' => $this->t('Referrer keyword'),
118218
      'help' => $this->t('The keyword of the previous site search.'),
118318
      'field' => [
118418
        'id' => 'standard',
118518
      ],
118618
      'sort' => [
118718
        'id' => 'standard',
118818
      ],
118918
      'filter' => [
119018
        'id' => 'string',
119118
      ],
119218
    ];
119318
    $data['visitors_event']['event_value'] = [
119418
      'title' => $this->t('Event value'),
119518
      'help' => $this->t('The Matomo event value.'),
119618
      'field' => [
119718
        'id' => 'numeric',
119818
      ],
119918
      'sort' => [
120018
        'id' => 'standard',
120118
      ],
120218
      'filter' => [
120318
        'id' => 'numeric',
120418
      ],
120518
    ];
120618
    $data['visitors_event']['title'] = [
120718
      'title' => $this->t('Visitors title'),
120818
      'help' => $this->t('The title of the visitors entry.'),
120918
      'field' => [
121018
        'id' => 'standard',
121118
      ],
121218
      'filter' => [
121318
        'id' => 'string',
121418
      ],
121518
    ];
121618
    $data['visitors_event']['uid'] = [
121718
      'title' => $this->t('Visitors Event User'),
121818
      'help' => $this->t('The user ID of the event.'),
121918
      'field' => [
122018
        'id' => 'standard',
122118
      ],
122218
      'relationship' => [
122318
        'title' => $this->t('User'),
122418
        'help' => $this->t('The user entity from the visitor entry.'),
122518
        'base' => 'users_field_data',
122618
        'base field' => 'uid',
122718
        'id' => 'standard',
122818
      ],
122918
      'filter' => [
123018
        'id' => 'string',
123118
      ],
123218
      'argument' => [
123318
        'id' => 'string',
123418
      ],
123518
    ];
123618
    $data['visitors_event']['url_prefix'] = [
123718
      'title' => $this->t('URL Prefix'),
123818
      'help' => $this->t('The URL Prefix.'),
123918
      'field' => [
124018
        'id' => 'visitors_url_prefix',
124118
      ],
124218
    ];
124318
    $data['visitors_event']['url'] = [
124418
      'title' => $this->t('Visitors URL'),
124518
      'help' => $this->t('The URL of the visitors entry.'),
124618
      'field' => [
124718
        'id' => 'standard',
124818
      ],
124918
      'filter' => [
125018
        'id' => 'string',
125118
      ],
125218
    ];
125318
    $data['visitors_event']['event'] = [
125418
      'title' => $this->t('Event'),
125518
      'help' => $this->t('The visitors event name.'),
125618
      'field' => [
125718
        'id' => 'standard',
125818
      ],
125918
      'sort' => [
126018
        'id' => 'standard',
126118
      ],
126218
      'filter' => [
126318
        'id' => 'string',
126418
      ],
126518
      'argument' => [
126618
        'id' => 'string',
126718
      ],
126818
    ];
126918
    $data['visitors_event']['path'] = [
127018
      'title' => $this->t('Visitors path'),
127118
      'help' => $this->t('The path of the visitors entry.'),
127218
      'field' => [
127318
        'id' => 'standard',
127418
      ],
127518
      'filter' => [
127618
        'id' => 'string',
127718
      ],
127818
      'argument' => [
127918
        'id' => 'string',
128018
      ],
128118
    ];
128218
    $data['visitors_event']['route'] = [
128318
      'title' => $this->t('Route'),
128418
      'help' => $this->t('The route of the visitors entry.'),
128518
      'field' => [
128618
        'id' => 'standard',
128718
      ],
128818
      'filter' => [
128918
        'id' => 'string',
129018
      ],
129118
      'argument' => [
129218
        'id' => 'string',
129318
      ],
129418
    ];
129518
    $data['visitors_event']['current_path'] = [
129618
      'title' => $this->t('Current path'),
129718
      'help' => $this->t('The current path, with parts removed or added.'),
129818
      'filter' => [
129918
        'id' => 'visitors_current_path',
130018
        'field' => 'path',
130118
      ],
130218
    ];
130318
    $data['visitors_event']['current_route'] = [
130418
      'title' => $this->t('Current route'),
130518
      'help' => $this->t('Shows rows for the route of this page. Remove or add path parts first when this page is not the route you want.'),
130618
      'filter' => [
130718
        'id' => 'visitors_current_route',
130818
        'field' => 'route',
130918
      ],
131018
    ];
131118
    $data['visitors_event']['referrer_url'] = [
131218
      'title' => $this->t('Visitors referer'),
131318
      'help' => $this->t('The referer of the visitors entry, without the protocol or www.'),
131418
      'field' => [
131518
        'id' => 'standard',
131618
      ],
131718
      'filter' => [
131818
        'id' => 'string',
131918
      ],
132018
      'argument' => [
132118
        'id' => 'string',
132218
      ],
132318
      'sort' => [
132418
        'id' => 'standard',
132518
      ],
132618
    ];
132718
    $data['visitors_event']['referrer_url_prefix'] = [
132818
      'title' => $this->t('Referrer URL prefix'),
132918
      'help' => $this->t('The protocol and whether the referrer started with www.'),
133018
      'field' => [
133118
        'id' => 'visitors_url_prefix',
133218
      ],
133318
      'filter' => [
133418
        'id' => 'numeric',
133518
      ],
133618
      'sort' => [
133718
        'id' => 'standard',
133818
      ],
133918
    ];
134018
    $data['visitors_event']['referrer_internal'] = [
134118
      'title' => $this->t('Internal referrer'),
134218
      'help' => $this->t('Whether the referrer host matches the viewed page.'),
134318
      'field' => [
134418
        'id' => 'boolean',
134518
      ],
134618
      'filter' => [
134718
        'id' => 'boolean',
134818
      ],
134918
      'sort' => [
135018
        'id' => 'standard',
135118
      ],
135218
    ];
135318
    $data['visitors_event']['referrer_path'] = [
135418
      'title' => $this->t('Referrer path'),
135518
      'help' => $this->t('The Drupal path of an internal referrer.'),
135618
      'field' => [
135718
        'id' => 'standard',
135818
      ],
135918
      'filter' => [
136018
        'id' => 'string',
136118
      ],
136218
      'argument' => [
136318
        'id' => 'string',
136418
      ],
136518
      'sort' => [
136618
        'id' => 'standard',
136718
      ],
136818
    ];
136918
    $data['visitors_event']['referrer_route'] = [
137018
      'title' => $this->t('Referrer route'),
137118
      'help' => $this->t('The Drupal route of an internal referrer.'),
137218
      'field' => [
137318
        'id' => 'standard',
137418
      ],
137518
      'filter' => [
137618
        'id' => 'string',
137718
      ],
137818
      'argument' => [
137918
        'id' => 'string',
138018
      ],
138118
      'sort' => [
138218
        'id' => 'standard',
138318
      ],
138418
    ];
138518
    $data['visitors_event']['server'] = [
138618
      'title' => $this->t('Server'),
138718
      'help' => $this->t('The server that generated the response.'),
138818
      'field' => [
138918
        'id' => 'standard',
139018
      ],
139118
      'filter' => [
139218
        'id' => 'string',
139318
      ],
139418
      'argument' => [
139518
        'id' => 'string',
139618
      ],
139718
    ];
139818
    $data['visitors_event']['pf_network'] = [
139918
      'title' => $this->t('Network'),
140018
      'help' => $this->t('Network performance.'),
140118
      'field' => [
140218
        'id' => 'numeric',
140318
      ],
140418
      'sort' => [
140518
        'id' => 'standard',
140618
      ],
140718
      'filter' => [
140818
        'id' => 'numeric',
140918
      ],
141018
      'argument' => [
141118
        'id' => 'numeric',
141218
      ],
141318
    ];
141418
    $data['visitors_event']['pf_server'] = [
141518
      'title' => $this->t('Server'),
141618
      'help' => $this->t('Server performance.'),
141718
      'field' => [
141818
        'id' => 'numeric',
141918
      ],
142018
      'sort' => [
142118
        'id' => 'standard',
142218
      ],
142318
      'filter' => [
142418
        'id' => 'numeric',
142518
      ],
142618
      'argument' => [
142718
        'id' => 'numeric',
142818
      ],
142918
    ];
143018
    $data['visitors_event']['pf_transfer'] = [
143118
      'title' => $this->t('Transfer'),
143218
      'help' => $this->t('Transfer performance.'),
143318
      'field' => [
143418
        'id' => 'numeric',
143518
      ],
143618
      'sort' => [
143718
        'id' => 'standard',
143818
      ],
143918
      'filter' => [
144018
        'id' => 'numeric',
144118
      ],
144218
      'argument' => [
144318
        'id' => 'numeric',
144418
      ],
144518
    ];
144618
    $data['visitors_event']['pf_dom_processing'] = [
144718
      'title' => $this->t('DOM Processing'),
144818
      'help' => $this->t('DOM Processing performance.'),
144918
      'field' => [
145018
        'id' => 'numeric',
145118
      ],
145218
      'sort' => [
145318
        'id' => 'standard',
145418
      ],
145518
      'filter' => [
145618
        'id' => 'numeric',
145718
      ],
145818
      'argument' => [
145918
        'id' => 'numeric',
146018
      ],
146118
    ];
146218
    $data['visitors_event']['pf_dom_complete'] = [
146318
      'title' => $this->t('DOM Complete'),
146418
      'help' => $this->t('DOM Complete performance.'),
146518
      'field' => [
146618
        'id' => 'numeric',
146718
      ],
146818
      'sort' => [
146918
        'id' => 'standard',
147018
      ],
147118
      'filter' => [
147218
        'id' => 'numeric',
147318
      ],
147418
      'argument' => [
147518
        'id' => 'numeric',
147618
      ],
147718
    ];
147818
    $data['visitors_event']['pf_on_load'] = [
147918
      'title' => $this->t('On Load'),
148018
      'help' => $this->t('On Load performance.'),
148118
      'field' => [
148218
        'id' => 'numeric',
148318
      ],
148418
      'sort' => [
148518
        'id' => 'standard',
148618
      ],
148718
      'filter' => [
148818
        'id' => 'numeric',
148918
      ],
149018
      'argument' => [
149118
        'id' => 'numeric',
149218
      ],
149318
    ];
149418
    $data['visitors_event']['pf_total'] = [
149518
      'title' => $this->t('Total'),
149618
      'help' => $this->t('Total performance.'),
149718
      'field' => [
149818
        'id' => 'numeric',
149918
      ],
150018
      'sort' => [
150118
        'id' => 'standard',
150218
      ],
150318
      'filter' => [
150418
        'id' => 'numeric',
150518
      ],
150618
      'argument' => [
150718
        'id' => 'numeric',
150818
      ],
150918
    ];
151018
    $data['visitors_event']['created'] = [
151118
      'title' => $this->t('Created'),
151218
      'help' => $this->t('The timestamp of the page view.'),
151318
      'field' => [
151418
        'id' => 'date',
151518
        'click sortable' => TRUE,
151618
      ],
151718
      'sort' => [
151818
        'id' => 'date',
151918
      ],
152018
      'filter' => [
152118
        'id' => 'visitors_date',
152218
      ],
152318
    ];
152418
    $data['visitors_event']['visitors_hour'] = [
152518
      'title' => $this->t('Hour'),
152618
      'help' => $this->t('The hour (server) of the visit.'),
152718
      'field' => [
152818
        'id' => 'visitors_hour',
152918
        'field' => 'created',
153018
      ],
153118
      'sort' => [
153218
        'id' => 'visitors_timestamp',
153318
        'field' => 'created',
153418
      ],
153518
    ];
153618
    $data['visitors_event']['visitors_month'] = [
153718
      'title' => $this->t('Month'),
153818
      'help' => $this->t('The month of the visit.'),
153918
      'field' => [
154018
        'id' => 'visitors_month',
154118
        'field' => 'created',
154218
      ],
154318
      'sort' => [
154418
        'id' => 'visitors_timestamp',
154518
        'field' => 'created',
154618
      ],
154718
    ];
154818
    $data['visitors_event']['visitors_local_hour'] = [
154918
      'title' => $this->t('Local hour'),
155018
      'help' => $this->t('Visitors local time.'),
155118
      'field' => [
155218
        'id' => 'visitors_local_hour',
155318
        'field' => 'created',
155418
      ],
155518
      'sort' => [
155618
        'id' => 'visitors_timestamp',
155718
        'field' => 'created',
155818
      ],
155918
    ];
156018
    $data['visitors_event']['visitors_day_of_week'] = [
156118
      'title' => $this->t('Day of Week'),
156218
      'help' => $this->t('The day of week of the visit.'),
156318
      'field' => [
156418
        'id' => 'visitors_day_of_week',
156518
        'field' => 'created',
156618
      ],
156718
      'sort' => [
156818
        'id' => 'visitors_timestamp',
156918
        'field' => 'created',
157018
      ],
157118
    ];
157218
    $data['visitors_event']['visitors_day_of_month'] = [
157318
      'title' => $this->t('Day of Month'),
157418
      'help' => $this->t('The day of month of the visit.'),
157518
      'field' => [
157618
        'id' => 'visitors_day_of_month',
157718
        'field' => 'created',
157818
      ],
157918
      'sort' => [
158018
        'id' => 'visitors_timestamp',
158118
        'field' => 'created',
158218
      ],
158318
    ];
158418
    $data['visitors_event']['visitors_day'] = [
158518
      'title' => $this->t('Day'),
158618
      'help' => $this->t('The day of the visit.'),
158718
      'field' => [
158818
        'id' => 'visitors_day',
158918
        'field' => 'created',
159018
      ],
159118
      'sort' => [
159218
        'id' => 'visitors_timestamp',
159318
        'field' => 'created',
159418
      ],
159518
    ];
159618
    $data['visitors_event']['visitors_week'] = [
159718
      'title' => $this->t('Week'),
159818
      'help' => $this->t('The week of the visit.'),
159918
      'field' => [
160018
        'id' => 'visitors_week',
160118
        'field' => 'created',
160218
      ],
160318
      'sort' => [
160418
        'id' => 'visitors_timestamp',
160518
        'field' => 'created',
160618
      ],
160718
    ];
160818
    $data['visitors_visit']['media'] = [
160918
      'title' => $this->t('Media'),
161018
      'help' => $this->t('Media played during the visit.'),
161118
      'relationship' => [
161218
        'title' => $this->t('Media'),
161318
        'help' => $this->t('Relate a visit to the media viewed during it.'),
161418
        'base' => 'visitors_media',
161518
        'base field' => 'visit_id',
161618
        'relationship field' => 'id',
161718
        'id' => 'standard',
161818
        'label' => $this->t('Media'),
161918
      ],
162018
    ];
162118
    $data['visitors_media']['table']['group'] = $this->t('Visitors');
162218
    $data['visitors_media']['table']['base'] = [
162318
      'title' => $this->t('Visitors media'),
162418
      'help' => $this->t('Audio and video viewed during a visit.'),
162518
    ];
162618
    $data['visitors_media']['table']['join']['visitors_visit'] = [
162718
      'left_field' => 'id',
162818
      'field' => 'visit_id',
162918
    ];
163018
    $data['visitors_media']['id'] = [
163118
      'title' => $this->t('Impressions'),
163218
      'help' => $this->t('How many times the media was seen.'),
163318
      'field' => [
163418
        'id' => 'numeric',
163518
      ],
163618
      'sort' => [
163718
        'id' => 'standard',
163818
      ],
163918
      'filter' => [
164018
        'id' => 'numeric',
164118
      ],
164218
    ];
164318
    $data['visitors_media']['title'] = [
164418
      'title' => $this->t('Media title'),
164518
      'help' => $this->t('The title of the audio or video.'),
164618
      'field' => [
164718
        'id' => 'standard',
164818
      ],
164918
      'sort' => [
165018
        'id' => 'standard',
165118
      ],
165218
      'filter' => [
165318
        'id' => 'string',
165418
      ],
165518
      'argument' => [
165618
        'id' => 'string',
165718
      ],
165818
    ];
165918
    $data['visitors_media']['media_type'] = [
166018
      'title' => $this->t('Media type'),
166118
      'help' => $this->t('Whether the media is audio or video.'),
166218
      'field' => [
166318
        'id' => 'standard',
166418
      ],
166518
      'sort' => [
166618
        'id' => 'standard',
166718
      ],
166818
      'filter' => [
166918
        'id' => 'string',
167018
      ],
167118
      'argument' => [
167218
        'id' => 'string',
167318
      ],
167418
    ];
167518
    $data['visitors_media']['play_count'] = [
167618
      'title' => $this->t('Plays'),
167718
      'help' => $this->t('How many times playback started.'),
167818
      'field' => [
167918
        'id' => 'numeric',
168018
      ],
168118
      'sort' => [
168218
        'id' => 'standard',
168318
      ],
168418
      'filter' => [
168518
        'id' => 'numeric',
168618
      ],
168718
    ];
168818
    $data['visitors_media']['finish_count'] = [
168918
      'title' => $this->t('Finishes'),
169018
      'help' => $this->t('How many times playback reached the end.'),
169118
      'field' => [
169218
        'id' => 'numeric',
169318
      ],
169418
      'sort' => [
169518
        'id' => 'standard',
169618
      ],
169718
      'filter' => [
169818
        'id' => 'numeric',
169918
      ],
170018
    ];
170118
    $data['visitors_media']['play_rate'] = [
170218
      'title' => $this->t('Play rate'),
170318
      'help' => $this->t('Plays divided by impressions.'),
170418
      'real field' => 'play_count',
170518
      'field' => [
170618
        'id' => 'visitors_media_rate',
170718
      ],
170818
    ];
170918
    $data['visitors_media']['finish_rate'] = [
171018
      'title' => $this->t('Finish rate'),
171118
      'help' => $this->t('Finishes divided by plays.'),
171218
      'real field' => 'finish_count',
171318
      'field' => [
171418
        'id' => 'visitors_media_rate',
171518
      ],
171618
    ];
171718
    $data['visitors_media']['progress_percent'] = [
171818
      'title' => $this->t('Progress'),
171918
      'help' => $this->t('How far into the media the visitor got.'),
172018
      'field' => [
172118
        'id' => 'numeric',
172218
      ],
172318
      'sort' => [
172418
        'id' => 'standard',
172518
      ],
172618
      'filter' => [
172718
        'id' => 'numeric',
172818
      ],
172918
    ];
173018
    $data['visitors_media']['spent_time'] = [
173118
      'title' => $this->t('Time spent'),
173218
      'help' => $this->t('How long the media was actually playing.'),
173318
      'field' => [
173418
        'id' => 'visitors_media_spent_time',
173518
      ],
173618
      'sort' => [
173718
        'id' => 'standard',
173818
      ],
173918
      'filter' => [
174018
        'id' => 'numeric',
174118
      ],
174218
    ];
174318
    $data['visitors_media']['created'] = [
174418
      'title' => $this->t('Media seen'),
174518
      'help' => $this->t('When the media was first seen.'),
174618
      'field' => [
174718
        'id' => 'date',
174818
      ],
174918
      'sort' => [
175018
        'id' => 'date',
175118
      ],
175218
      'filter' => [
175318
        'id' => 'visitors_date',
175418
      ],
175518
    ];
175618
    $data['visitors_visit']['visitors_date_filter'] = [
175718
      'title' => $this->t('Visitors date filter'),
175818
      'help' => $this->t('Shows the shared Visitors date range form.'),
175918
      'area' => [
176018
        'id' => 'visitors_date_filter',
176118
      ],
176218
    ];
176318
    $data['visitors_visit']['visitors_display_link'] = [
176418
      'title' => $this->t('Link to Visitors display'),
176518
      'help' => $this->t('Displays a link to a non-path-based display of this view while keeping the filter criteria, sort criteria, pager settings and contextual filters.'),
176618
      'area' => [
176718
        'id' => 'visitors_display_link',
176818
      ],
176918
    ];
177018
    return $data;
1771
  }
1772
1773
}