Analytics without cookies: how we built our own Google Analytics replacement
Nine sites, one dashboard, no cookies and no consent banner for statistics. Over the last thirty days: 1,083 human sessions and 854 bot sessions that had to be filtered out — 44% of all traffic.
Why not simply Google Analytics
The first reason is legal and dull: a tool that writes tracking cookies needs the visitor's consent. Consent needs a banner. A banner lowers the credibility of a site and — this is said less often — corrupts the data itself, because some people decline and then never appear in the statistics at all.
The second reason is practical: we needed answers to a handful of specific questions, not three hundred. Where did this person come from, what did they click, did they fill in the form. That does not call for a tool capable of building a sales funnel for a retail chain.
The third reason is professional. We build systems for companies and we tell clients their data should stay with them. That is hard to repeat with conviction while sending your own visitor data to somebody else's service.
Counting people without storing anything on their device
The key question: how do you tell two visits by the same person from visits by two different people, when you may not leave a marker in the browser? The answer we use is a fingerprint computed on the server — from the network address, the browser details and the day. The same person returning the same day is counted once. The same person tomorrow is a new visit.
That is a deliberate trade-off. You lose the ability to follow one person across weeks — which is exactly the point. You gain not having to ask anybody for consent, because there is nothing to store.
The short version for anyone asking whether this is lawful: there are no cookies, so there is nothing to declare in a consent banner. It does not remove the duty to state in your privacy policy what you measure and why — that stays.
44% of traffic is not human
This is the number worth remembering even if you never build your own analytics. Over the last thirty days across nine sites we recorded:
Almost half the traffic is automated: search engines, competitors' analysis tools, security scanners, crawlers collecting data for language models. If somebody shows you a report with „visits up 40%”, the first question is whether bots are filtered out, and how they are recognised.
Our mechanism re-examines traffic every hour, because some automation is only recognisable from a behaviour pattern rather than from the first request. A session can therefore be reclassified from human to bot an hour after the fact — and that is correct behaviour, not a bug.
What it gives you in practice
The dashboard answers the questions we actually ask: which countries people arrive from (twenty-four last month), which pages they read, what they clicked before filling in the form. Plus a module where you can flag a specific person — somebody you sent a proposal to, say — and see whether they came back.
The whole thing is eleven tables in the database, data split into monthly parts so queries do not slow down as history grows, and a tracking script of about five kilobytes — one file, no external dependencies. For comparison, a typical analytics stack on a company website runs to several hundred kilobytes.
What is worth measuring and what is decoration
The biggest temptation when building your own analytics is to measure everything, since you are collecting events anyway. A few months later there are thirty charts in the dashboard and nobody looks at any of them.
Four things that genuinely change decisions:
- Where they came from. Search, direct, a link, a campaign — this settles whether work on visibility is having an effect.
- What they read before making contact. The path of pages before a form submission says more than any traffic chart.
- Where they leave. The page most visits end on is usually either badly written or badly linked.
- Whether they came back. In B2B selling, a return visit a few days later is a stronger signal than the length of the first one.
The rest — click maps, session recordings, ten variations of the same chart — is interesting once, at first launch. We deliberately did not build it.
Why the data has to be split by month
A technical detail with a direct bearing on whether the dashboard still opens two years from now. Events are stored in a table split into monthly parts. A query about the last thirty days then touches one or two parts rather than the whole history.
Without that split, every refresh scans everything ever recorded. At first there is no visible difference. After a year the dashboard thinks for a second, after two it takes five, and after three somebody declares that „this analytics is slow” and stops using it.
The same mechanism answers the question about deleting old data: dropping one monthly part is a single operation rather than a search through the table by date. With visitor data that matters legally too — a retention policy that is expensive to execute does not, in practice, get executed.
How this differs from tools that also say „no cookies”
There are several analytics tools on the market advertising themselves as cookie-free and compliant. They are good, and for most companies they are a better choice than building your own. It is only worth knowing what to ask:
- Where does the data sit? „No cookies” does not mean „in Europe”. Those are two separate things and only one tends to be on the front page.
- Do they filter bots, and by what? At our traffic levels bots are 44%. A tool that does not filter them will show you a result twice as good, and it will not be true.
- What happens when you pass the pageview threshold? Most price by pageviews, which with growing traffic means a growing bill for the same knowledge.
We built our own because we had nine sites and clearly defined needs — and at nine sites the bill for a ready-made tool starts to be an argument. With a single company website that calculation looks different, and we honestly recommend the ready-made option then.
What it taught us about our own sites
A tool built for yourself has the advantage that you see immediately whether it answers real questions. Three things we learned about our own sites that we had not suspected:
- Traffic arrives from twenty-four countries, including ones we have no language version for. That was one of the arguments for adding English and Spanish versions of the site.
- Almost half the traffic is automated. Before we filtered it, the charts looked much better and much less true.
- People read product pages for longer than the home page. That changed how we write them — away from describing what a system does, towards describing which problem it solves.
None of those three required an elaborate tool. All three required the data to be trustworthy — bots filtered, visitors counted sensibly.
When this does NOT make sense
Do not build your own analytics if you need to benchmark against the market, run extensive advertising campaigns or track multi-channel funnels. There are ready-made tools for that and they do it better — we have no ambition to replace them.
It makes sense if you want to know what happens on your site without a consent banner, without sending visitor data outside the company, and without a fee that grows with pageviews. Yes, that is a shorter feature list. It was a design decision, not a lack of time.