OnyxMetric
Integration Guides

Zola

Step-by-step guide to add OnyxMetric cookieless analytics to your Zola site and start tracking visitors

Zola pages extend a base Tera template, normally templates/base.html, so the tag belongs in that file's <head>. The [extra] table in config.toml is a good home for the site ID.

Copy your tracking snippet

In OnyxMetric, open your site's Site Settings and copy the tracking script. It looks like this:

<script src="https://app.onyxmetric.com/api/script.js?siteId=YOUR_SITE_ID" async></script>

YOUR_SITE_ID is the numeric ID of your site.

Add the snippet to Zola

  1. Add the ID to config.toml:

    config.toml
    [extra]
    onyxmetric_site_id = "YOUR_SITE_ID"
  2. Edit templates/base.html. The config.mode check excludes zola serve, so local work is not tracked:

    templates/base.html
    <head>
      ...
      {% if config.mode == "build" %}
        <script src="https://app.onyxmetric.com/api/script.js?siteId={{ config.extra.onyxmetric_site_id }}" async></script>
      {% endif %}
    </head>

    If a theme provides base.html, copy it from themes/<theme>/templates/ into your own templates/ first. A file with the same name in your site overrides the theme's.

  3. Build and deploy public/:

    zola build

Check that it works

Load your live site and click through a few pages. Pageviews show up in the OnyxMetric dashboard within seconds.

If nothing arrives:

  • View the page source and search for script.js?siteId= to confirm the tag is present.
  • In the browser's Network tab, check that script.js returns 200 and that requests go to /api/track.
  • Turn off ad blockers, or proxy the script through your own domain.
  • Read script troubleshooting for other causes.

Troubleshooting

  • Tag missing locally: zola serve sets config.mode to serve. Check the output of zola build.
  • config.mode undefined: older Zola releases lack it. Upgrade, or remove the if and accept local pageviews.
  • Some pages without the tag: templates that do not extend base.html (such as a custom 404.html) need the tag separately.

Next steps

On this page