Skip to content

Matomo

Matomo (formerly Piwik) analytics service plugin.

Outputs Matomo's standard JavaScript tracking code.


See Also:

  • https://developer.matomo.org/guides/tracking-javascript-guide

Methods

defaultConfiguration

{@inheritdoc}

public defaultConfiguration(): array

buildConfigurationForm

{@inheritdoc}

public buildConfigurationForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

getOutput

Returns the output of the analytics service.

public getOutput(): array

Return Value:

A structured, renderable array.


getCspSources

Gets the Content Security Policy sources the service's output needs.

public getCspSources(): array<string,string[]>

The instance serves matomo.js and receives the tracking requests it sends to matomo.php.

Return Value:

URLs keyed by directive, such as ['script-src' => ['https://gc.zgo.at']].

See Also:

  • https://matomo.org/faq/general/faq_20904/

Inherited methods

setServiceId

Sets the current service config entity ID that is using this plugin.

public setServiceId(mixed $service_id): mixed

Parameters:

Parameter Type Description
$service_id mixed
The service config entity ID.

getServiceId

Gets the current service config entity ID that is using this plugin.

public getServiceId(): string

Return Value:

The service config entity ID.


__construct

{@inheritdoc}

public __construct(array $configuration, mixed $plugin_id, mixed $plugin_definition): mixed

Parameters:

Parameter Type Description
$configuration array
$plugin_id mixed
$plugin_definition mixed

create

{@inheritdoc}

public static create(\Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, mixed $plugin_id, mixed $plugin_definition): static
  • This method is static. Parameters:
Parameter Type Description
$container \Symfony\Component\DependencyInjection\ContainerInterface
$configuration array
$plugin_id mixed
$plugin_definition mixed

getLabel

Returns the label of the analytics service.

public getLabel(): string

Return Value:

The label of this analytics service.


access

{@inheritdoc}

public access(mixed $operation, ?\Drupal\Core\Session\AccountInterface $account = null, mixed $return_as_object = false): mixed

Parameters:

Parameter Type Description
$operation mixed
$account ?\Drupal\Core\Session\AccountInterface
$return_as_object mixed

hasMultipleInstances

Checks whether more than one analytics service uses this plugin.

public hasMultipleInstances(): bool

Return Value:

TRUE if two or more analytics services use this plugin.


getOutput

Returns the output of the analytics service.

public getOutput(): array

Return Value:

A structured, renderable array.


getCspSources

Gets the Content Security Policy sources the service's output needs.

public getCspSources(): array<string,string[]>

Return Value:

URLs keyed by directive, such as ['script-src' => ['https://gc.zgo.at']].


getCacheableUrls

Gets the URLs of the service's external files to cache locally.

public getCacheableUrls(): array

Return Value:

A list of URLs.


getCacheContexts

{@inheritdoc}

public getCacheContexts(): array

The output's cacheability. Plugins that vary their output by something other than their configuration add it here.


getCacheTags

{@inheritdoc}

public getCacheTags(): array

getCacheMaxAge

{@inheritdoc}

public getCacheMaxAge(): int

setConfiguration

{@inheritdoc}

public setConfiguration(array $configuration): mixed

Parameters:

Parameter Type Description
$configuration array

getConfiguration

{@inheritdoc}

public getConfiguration(): array

defaultConfiguration

{@inheritdoc}

public defaultConfiguration(): array

buildConfigurationForm

{@inheritdoc}

public buildConfigurationForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

validateConfigurationForm

{@inheritdoc}

public validateConfigurationForm(array& $form, \Drupal\Core\Form\FormStateInterface $form_state): mixed

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

submitConfigurationForm

{@inheritdoc}

public submitConfigurationForm(array& $form, \Drupal\Core\Form\FormStateInterface $form_state): mixed

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

calculateDependencies

{@inheritdoc}

public calculateDependencies(): array