Platforms
The tag goes in the head of every page. Here’s where that is on the platforms sites are most often built with.
Each platform has a place for code that goes in the head of every page: a theme file, a site setting, a layout or a tag manager. Put the tag there once and every page is counted, those you add later included. On most it’s paste, save, publish.
<script async data-domain="example.com" src="https://fiveb.ar/js/tally.js"></script>This is the tag from Getting started, with your domain in place of
example.com. However a platform adds it, keep its src, its data-domain and
any other attributes you give it: the script sends what it counts to the
address it was loaded from, and counts it under the site data-domain names.
If your site sends a Content Security Policy, allow fiveb.ar in it too. Once the tag is on, check it works.
Site builders
Each has a place for code that goes in the head of every page. Paste the tag there, and publish if the platform asks you to.
Frameworks and static sites
Put the tag in the layout every page shares. Where the framework moves between pages without loading them, each page is counted as a single-page app’s, with nothing more to add.
Other frameworks
The tag goes wherever the framework writes the <head> every page shares:
- Vite, and the React, Vue and Svelte apps built with it:
index.html. - Nuxt:
app.head.scriptinnuxt.config, withasync,srcand'data-domain'. - SvelteKit:
src/app.html. - Remix and React Router: the
<head>inapp/root.tsx. - Django, Rails, Laravel and other server frameworks: the base template every page extends.
Other static site generators
Eleventy, Jekyll and the rest work the same way: the tag goes in the <head> of the base
layout, such as a layout in Eleventy’s _includes folder or Jekyll’s
_layouts/default.html. Override a Jekyll theme’s file as you would Hugo’s, with a copy at the same
path in your site, such as _includes/head.html.
Tag managers
A tag manager can add the tag for you, on every page it runs on, with a few lines of script that each page below gives. On a single-page app, the script counts each page it moves to itself, and if the tag manager runs it again, it adds nothing.
The tag only runs where the tag manager does, so a visitor whose browser blocks the tag manager isn’t counted. A tag written into the page itself doesn’t have that problem.
Any other tag manager works the same way: add the script from one of these as a tag of custom HTML, or without its first and last lines where it takes JavaScript, have it run when each page loads, and publish.