Skip to content

GoatCounter - a free and open source web analytics platform that is easy to use

GoatCounter is a free, open source and easy to use analytics platform that offers free web analytics for your website or blog. Unlike other free tier offerings, this does not require self-hosting, and can be set up with a simple script tag on your home page.

GoatCounter setup

Navigate to GoatCounter Sign up for an account and follow the instructions to insert a simple script tag on your home page. Analytics will then be activated for you website.

MkDocs Material theme setup

Inserting 3rd party scripts on MkDocs Material is a bit more involved, but not too difficult. It requires a few more steps: MKDocs Material have good info on the steps involved. Navigate to MKDocs Material Customization where you will find the following information:

Overriding blocks

Setup and theme structure¶

Enable Material for MkDocs as usual in mkdocs.yml, and create a new folder for overrides which you then reference using the custom_dir setting:

theme:
name: material
custom_dir: overrides
Besides overriding partials, it's also possible to override (and extend) template blocks, which are defined inside the templates and wrap specific features. In order to set up block overrides, create a main.html file inside the overrides directory:
.
├─ overrides/
│  └─ main.html
└─ mkdocs.yml

If you intend to add something to a block rather than to replace it altogether with new content, use {{ super() }} inside the block to include the original block content. This is particularly useful when adding third-party scripts to your docs, e.g.

{% extends "base.html" %}

{% block scripts %}
  <!-- Add the GoatCounter Script here in this location -->
{{ super() }}
  <!-- Add scripts that need to run afterwards here -->
{% endblock %}