This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Matomo

Matomo is used as a user analysis tool (instead of Google Analytics). It’s hosted by Tocco itself and can be configured per instance.

Matomo JavaScipt API Documentation

Nice Configuration

To configure / activate Matomo tracking on an instance the siteId and baseUrl have to be configured:

nice2.web.matomo.siteId=1
nice2.web.matomo.baseUrl=https://matomo.tocco.ch/

Tracking

Per default following trackings are implemented:

  • Page visit

  • Action click

The tracking script is added to the admin and not yet active in any widget.

{matomoBaseUrl && matomoSiteId && (
    <matomo.MatomoTrackingScript
      siteId={matomoSiteId}
      baseUrl={matomoBaseUrl}
      consentGiven={!isTrackingDeactivated}
    />
)}

Track event

It’s possible to track any event by adding following code:

// category, action, name, value
matomo.trackEvent('action', 'click', 'copy', 2)

It doesn’t matter if Matomo is added / configured and if the user enabled tracking already. It only pushes the event to Matomo if all conditions are met.

Dev Environment

In order to test the Matomo tracking the local client can be connected to the Dev Matomo website.

To do that the following env variable have to be added to the local .env file.

MATOMO_SITE_ID=2
MATOMO_BASE_URL=https://matomo.tocco.ch/

The realtime data can be checked here.

Matomo Configuration

Matomo Instance

There are following Websites:

Name

Site ID

URLs

Tocco Testsysteme

1

https://master.tocco.ch, https://test313.tocco.ch, …

Testwebseite für Devs

2

http://localhost:3000, http://localhost:8080

Tocco Prodsysteme

(not yet configured)

(e.g. https://<kunde>.tocco.ch)

Note

Multiple customers are tracked on the same Matomo Websites. This helps to gather more meaningful data.

Important Settings

  • Privatsphäre → Daten anonymisieren

    • ✅ Anonymisiere die IP-Adresse von Besuchern

    • ✅ Benutzer ID mit Pseudonym austauschen

    • ✅ Tracking ohne Cookies erzwingen

  • System → Standorterkennung

    • ❎ Standorterkennungsdienst deaktiviert

  • Webseiten → Verwalten → Tocco Testsysteme / Tocco (*)

    • ✅ Zeichne Besuche und Aktionen nur auf, wenn die Aktions-URL mit einer der oben genannten URLs beginnt.

    • ✅ Nur Besucherprofil deaktivieren

(*) These settings should definitely be considered when creating new websites.