Updated 20 October 2026
Eleventy analytics
Privacy-first, cookieless analytics for Eleventy: one tag in the base layout, in every page 11ty builds.
In short
- One tag in the
<head>of your base layout, in Nunjucks, Liquid or any template language. - No plugin and no config: 11ty copies the tag into each page.
- No cookie banner needed in cookieless mode, no IP address stored, and nothing loaded from another company.
Install on Eleventy#
Use your own site id and server address in the code below. On trckable Cloud the address is https://cloud.trckable.com.
Put the tag in the head of the layout that all your pages use, for example _includes/base.njk.:
<head>
<meta charset="utf-8">
<title>{{ title }}</title>
<script
defer
data-site="tkb_a1b2c3d4"
data-domain="example.com"
src="https://stats.example.com/js/tkb_a1b2c3d4.js">
</script>
</head>
Open your site once, then run npx trckable doctor --host https://stats.example.com --site tkb_a1b2c3d4 --url https://example.com. It only reads, and tells you whether the tag is on the page and the server answers.
What to know about Eleventy#
- Add it to the layout, not to a page. A tag in one template only counts that page.
- Layout chaining works. If your layouts extend a base layout, the base is the one place to edit.
- The tag is a plain script, so it is not touched by your template language. Check that the quotes stay as they are in the output.
- Local
eleventy --servevisits are ignored because trckable does not count localhost unless the tag hasdata-dev.
Goals and revenue#
A goal needs no code: put an attribute on the element and each click is counted.
<button data-trckable-goal="signup" data-trckable-goal-plan="pro">Start trial</button>
Connect Stripe, Paddle, Lemon Squeezy, Polar or Dodo Payments with one key, and each payment is credited to the visit that earned it, so revenue shows next to traffic. See revenue attribution.
Questions#
- Does Eleventy need a plugin for this?
- No. The documented install for any site that lets you edit the head is the one script tag.
- Do I need a cookie banner on my Eleventy site?
- Not for the counting itself. In cookieless mode (add
data-cookielessto the tag) nothing is stored on the visitor's device and no IP address is kept. Whether your site needs a banner for other reasons is a question for your own situation; the cookie banner guide explains the rules in plain words. - Can ad blockers stop it?
- A blocker can block any script, and trckable does not claim otherwise. Sending events through your own domain removes the separate analytics file a blocklist would match by name, which is the accurate setup. The same-origin proxy guide shows how.
- Is it free for a Eleventy site?
- The server is open source and free to self-host, and the tracker is MIT licensed. If you would rather not run a server, trckable Cloud runs it for you; the plans are on the pricing page.