Connecting Matomo

You can connect a metrics collection service to your documentation portal. This allows you to see detailed analytics: who visited which article, from where, and whether they came from search or by direct link.

Matomo

Create a counter in Matomo first.

For a Docker-based portal

  1. In Gramax docker-compose.yaml, add environment variables for this counter:

    • MATOMO_SITE_ID — Site ID in Matomo. Optional if MATOMO_CONTAINER_URL is set.

    • MATOMO_URL — URL of the Matomo instance. Required if MATOMO_SITE_ID is used. Example: https://matomo.gram.ax or https://metrics.gram.ax/matomo.

    • MATOMO_CONTAINER_URL — URL of the Matomo container. Optional. Learn more.

      • Can be absolute (if MATOMO_URL is not set). Example: https://matomo.gram.ax or https://metrics.gram.ax/matomo.

      • Can be relative (if MATOMO_URL is set). Example: / or /metrics/matomo.

  2. Restart docker-compose.yaml.

For a static site

  1. Before building, set the same variables as for the Docker-based portal above. Or configure them in the configuration file:

    build: metrics: matomo: matomoSiteId: 1 matomoUrl: 'https://example.com/matomo' matomoContainerUrl: 'https://example.com/container'
  2. Build the site.

Yandex Metrica

  1. Create a counter in Yandex Metrica.

  2. Copy the counter number.

For a Docker-based portal

  1. In Gramax docker-compose.yaml, add this environment variable for the counter: YANDEX_METRIC_COUNTER:{meter number}.

  2. Restart docker-compose.yaml.

For a static site

  1. Before building, set YANDEX_METRIC_COUNTER:{meter number}.

    Or configure it in the configuration file:

    build: metrics: yandex: metricCounter: 12345678
  2. Build the site.