Craft Analytics
My aim was to build an analytics plugin that is lightweight, privacy-focused, and feature-rich, with GDPR compliance at the heart of its design. Craft Analytics runs on your own server, understands your Craft content, and gives you useful reports without sending visitor data to a third-party platform.
It also understands your content: it can tell you how the Blog section is doing, not just that /blog/some-slug got 400 views.
What it does differently
- No cookies, so no banner. Visitors are counted with a hash built from a salt that is thrown away and replaced every 24 hours. Nothing is stored on anyone's device.
- No IP addresses. The address is used in memory to work out that hash and then dropped. It is never written to a table, a log or a cache key.
- No per-visitor records. The database holds counts. If someone asks what you know about them, the answer is nothing.
- No effect on page speed. Everything happens after the response has been sent. We measure a 0.46 ms difference in time-to-first-byte, which is within the noise.
- Storage that does not track traffic. A page viewed a million times takes up the same one row as a page viewed twice.
- Reports built on your content model. Traffic by section, entry type and author, because Craft already knows all of that.
Start here
- Installation & setup - about ten minutes. The cron step is the one people miss.
- How tracking works - the modes, and what each one costs you
- Static & edge caching - read this if you run Blitz, Cloudflare or Varnish
- Importing from GA4 - bring your history across so the reports do not start empty
Reports
- The screens - what everything means
- Content - by section, entry type and author
- Goals - counting what matters (Pro)
- Funnels - where people leave (Pro)
- Campaigns, geography & events (Pro)
Privacy
- How visitors are counted - read this before comparing the numbers with Google Analytics
- Privacy & compliance - the banner-free argument, consent, DSARs and the paperwork
Configuration
For developers
- Twig API - popular entries, view counts, site totals
- Extending (Pro) - segment your traffic by what your own site knows, use your own IDs for consented visitors, and the events you can already listen to
- GraphQL API (Pro)
- Performance - how the zero-TTFB claim works and what it measures at
- Attribution & prior art
When something's wrong
- Troubleshooting - starting with empty reports, which is almost always the cron
Lite vs Pro
Lite is a usable analytics tool on its own, not a trial of Pro.
| Lite | Pro | |
|---|---|---|
| Pageviews, visitors, sessions, bounce rate | ✅ | ✅ |
| Real-time | ✅ | ✅ |
| Pages, sources, devices | ✅ | ✅ |
| Content: sections, entry types, authors | ✅ | ✅ |
| Crawler reporting | ✅ | ✅ |
| CSV & JSON export | ✅ | ✅ |
| Entry sidebar & dashboard widgets | ✅ | ✅ |
| Campaigns & attribution | ✅ | |
| Geography | ✅ | |
| Events, outbound clicks, downloads, scroll | ✅ | |
| Goals & funnels | ✅ | |
| Formie & Commerce integrations | ✅ | |
| Consent-aware Tier 2 | ✅ | |
| Segments & the extension API | ✅ | |
| Emailed summaries | ✅ | |
| GraphQL API | ✅ |
Upgrading is a licence change. Both editions use the same tables, so there is no migration to run and your existing data carries over.
A note on AI
In the spirit of being upfront: I used AI tooling while building this plugin, to think through approaches, to speed up some of the groundwork, and to help draft these docs. It was a tool in the workshop, not the builder. Every line of code was reviewed, tested and put in place by a developer who understood it, and nothing shipped that I could not explain and stand behind. The judgement calls and the final code are human.