Integration Guides

Zola

Add Rybbit analytics to your Zola site

Zola pages extend a base Tera template, normally templates/base.html, so the snippet goes in that file's <head>. Keep the site ID in the [extra] section of config.toml, which every template can read as config.extra.

Get your tracking snippet

In your Rybbit dashboard, open Site Settings → Tracking Script and copy your snippet. It looks like this:

<script src="https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID" defer></script>

YOUR_SITE_ID is the numeric ID of your site. If you self-host Rybbit, app.rybbit.io is the domain of your own instance.

Add the snippet to Zola

  1. Add your site ID under [extra] in config.toml. rybbit_instance_url is only needed if you self-host:

    config.toml
    [extra]
    rybbit_site_id = "YOUR_SITE_ID"
    rybbit_instance_url = "https://app.rybbit.io"
  2. Open templates/base.html and add the tag inside <head>. The config.mode check keeps the script out of zola serve, so local development is not tracked:

    templates/base.html
    <head>
      ...
      {% if config.mode == "build" %}
        <script src="{{ config.extra.rybbit_instance_url }}/api/script.js?siteId={{ config.extra.rybbit_site_id }}" defer></script>
      {% endif %}
    </head>

    If a theme owns base.html, copy it from themes/<theme>/templates/base.html into your own templates/ directory first. A template in your site with the same name overrides the theme's copy, so the theme can be updated without losing the change.

  3. Build and deploy the generated public/ directory:

    zola build

Verify installation

Open your live site in a new tab and click through a few pages. Within a few seconds the pageviews appear in the Rybbit dashboard.

If nothing shows up:

  • View the page source and search for script.js?siteId= to confirm the snippet is on the page.
  • Open the browser Network tab and check that script.js returns 200 and that POST requests go to /api/track.
  • Disable ad blockers, or set up a proxy so the script loads from your own domain.
  • See the script troubleshooting guide for other common causes.

Troubleshooting

  • Snippet missing from the page source: zola serve sets config.mode to serve, so the guard removes the tag. Check the output of zola build instead.
  • config.mode is not defined: older Zola releases do not expose it. Upgrade, or drop the if block and accept local pageviews.
  • Pages without the tag: templates that do not {% extends "base.html" %} (a custom 404.html, or a section template that builds its own <head>) need the tag added separately.

Next steps

On this page