Analytics

This theme has built in support for various analytic tools. Currently, it supports the following analytics:

For a complete list of supported analytics, please refer the sample config.yaml file.

Warning: When adding analytics, you should consider local legislation to see if a privacy banner is required to inform users of the tracking in personal data. In general (not legal advice), privacy-friendly, anonymous methods such as counter.dev and GoatCounter don’t need a banner, since they do not collect personally identifiable data.

Goat Counter

GoatCounter is the most complete, simple and privacy friendly analytics method supported in Toha. Its script tracks the most viewed pages, total number of users, devices, and much more, all while being open source!

To enable GoatCounter analytics in your site, you have two options: one is to sign in at goatcounter.com and obtain a code for your site, the second is to self-hosted an instance of GoatCounter. Then, you have to add analytics section under params.features section of your config.yaml file as below:

analytics:
  enable: true
  services:
    # GoatCounter
    goatCounter:
      code: <your GoatCounter code>  # Not self-hosted
      instance: <your GoatCounter instance url>  # For self-hosted you should use only one of the two methods

counter.dev

counter.dev is a simple, privacy friendly and open source analytics website which enables you to track the total user count, first visited page and some other metrics on your website. Unfortunately, to keep things simple (and free) they don’t show a ranking of the most visited pages, but rather the ones that are accessed the first.

You can enable it by adding the email you registered with at counter.dev’s page under params.features section in your config.yaml as below:

analytics:
  enable: true
  services:
    counterDev:
      id: <your counter.dev id>

The tracking code will be automatically added to your site.

Note: On some sites, an error has been detected where only the root directory ("/") is passed over to counter.dev, so the tracking wont show anything under the “pages” section. To fix this, one can add referrerPolicy: no-referrer-when-downgrade as a parameter on the “counterDev” section, ensuring that new page visits are always correctly passed onto counter.dev.

Google Analytics

Beware that according to recent case law, Google Analytics might be illegal in the European Union

You can enable Google Analytics in your site by adding your tracking id under params.features section in your config.yaml file as below:

analytics:
  enable: true
  services:
    # Google Analytics
    google:
      id: <your Google Analytics tracking id>

You can use both V3 or V4 tracking ID. The theme will automatically detect the tracking code version and add the respective tracking scripts accordingly to your site.

For additional privacy settings regarding Google Analytics, you can provide privacy.googleAnalytics section in your config.yaml file as described here.

Matomo

You can enable Matomo (formerly Piwik) by adding the matomo configuration under params.features section in the config.yaml file as shown below:

analytics:
  enable: true
  services:
    # Matomo / Piwik
    matomo:
      instance: matomo.example.com
      siteId: 1 # The number generated after adding a site in your instance