One tag, in the <head> of every page. That is the whole install.
The snippet
Your install page renders this with your own site key already substituted — copy it from there rather than from this page, so you never have to hand-edit a placeholder.
<script
defer
data-website-id="ts_a1b2c3d4e5f6"
data-domain="example.com"
src="https://truestat.io/js/t.js"
></script>The install page with the snippet rendered, the real site key visible, and the copy button. Show the platform tab strip above it with "Plain HTML" selected. Light theme, desktop 1440px.
Four things about it worth knowing before you paste:
deferis deliberate. The script never blocks rendering and never runs before your page is parsed.It goes in
<head>, not before</body>. In<head>it is discovered earlier, and withdeferit still executes after parsing — you get the earlier fetch without the blocking.One tag, both jobs. You do not need to paste a second inline queue snippet for custom events. The queue ships inside the tag, so a
window.truestat("signup")call that fires before the script finishes loading is buffered and sent, not lost.It fails silently. If the collector is unreachable, the script does not throw, does not log by default, and does not affect your page.
On every page
The single most common install failure — across every platform — is the tag landing on the homepage only. If your platform has a global head or layout, that is where it goes. If you are pasting per-page, you have to paste it on every page.
Pick your platform
Installing TrueStat has a page each for:
Plain HTML — the baseline every other page assumes
Next.js — App Router and Pages Router
Squarespace, Wix, Ghost, Bubble and other head-field platforms
Google Tag Manager — needs a different snippet from the one above; the plain tag does not work reliably in GTM
One thing to know up front
Ad blockers block analytics by hostname. A visitor running uBlock Origin
will not send you an event, because the request to truestat.io never
leaves their browser. This is true of every analytics product, ours included, and
it is the main reason your numbers will be lower than Google Analytics'.
You can recover most of that traffic by serving the script and the collector from your own domain. See Serving the script from your own domain. You do not have to do it now, and nothing else in this guide depends on it.