Skip to content

Under construction · AGPL-3.0

Follow the path, not the person.

Open-source product analytics for Next.js: page views, funnels, retention and journeys, in one app on your own Vercel and Postgres. No cookies before a site identifies someone, and 1.5 KB in the browser.

A hosted version isn’t available. The npm package isn’t published yet: today you run Trailic from the repo.

//features/pricingsignup/welcome
A made-up visit, the way a funnel reads it.
The overview screen: totals, page views per day, and top pages and referrers.
A real screen from the app. Acme and its figures are made up, on a throwaway database.
No cookies
And nothing in the browser’s storage, until a site calls identify.
1.5 KB
Gzipped, in the browser. React is its only peer dependency.
One app
Next.js and Postgres, with no cloud service you don’t control.
/api/mcp
An MCP server, so an assistant can read the figures, with your rules.

How it works

From a page view to a figure, in four stops.

  1. 1

    Add a component

    One line in your layout counts page views and route changes. track and identify do the rest, when you call them.

  2. 2

    Events wait in a buffer

    The collector checks the key, the domain and the limits, and an event never touches the database. Batches wait in Vercel Queues, or a folder on a server of yours.

  3. 3

    Postgres, once an hour

    A job writes them in batches, so a serverless database can sleep. A failed write loses nothing, and a repeated one counts nothing twice.

  4. 4

    Read it

    On screens, or from an assistant through MCP. Every page says how old its data is, because “now” would be a lie.

What it shows

The questions a product team actually asks.

Each of these is a screen in the app and, except journeys for now, a tool an assistant can call.

Funnels: where people stop

Two to eight steps, each a page or an event, and how long people have from the first. It shows how many reached each step, in order, and how many stopped there.

Someone anonymous can only convert within a day, because their hash rotates. Identify them and a funnel can run for weeks.

The funnel screen: four steps from the pricing page to the welcome page, with bars narrowing and the drop-off at each step.

Retention: who comes back

Cohorts by the Monday of the week someone was first identified, and what share came back each week after, by any activity or by the event you choose.

Identified people only. An anonymous visitor is someone else tomorrow, on purpose.

The retention screen: a table of weekly cohorts, each cell shaded by the share of people who came back.

Journeys: where they go next

From any page: each visitor’s first time on it that day, then the next three pages within half an hour, most common first.

Journeys follow each visitor who reached the page, so they’re the one screen that slows down as a page gets busier.

The journeys screen: from the pricing page, the most common next pages, each path with its number of visits.

From an assistant

Ask your assistant, with your rules.

The MCP server is at /api/mcp. Add that address to Claude, ChatGPT or any MCP client as a remote connector: the client registers itself, you sign in and approve it, and each tool runs as you, with the same rules as the screens.

Changing or deleting a site, erasing someone and managing members stay on the screens: no assistant can do them.

These only read

  • list_workspacesYour workspaces
  • list_sitesSites, domains, last write
  • site_overviewA site’s or a workspace’s figures
  • top_pagesThe most viewed pages
  • list_eventsCustom events, by day
  • run_funnelConversion and drop-off
  • run_retentionCohorts, by week

These add what you asked for

  • create_siteAdds a site, for those who manage settings
  • create_workspaceStarts a workspace, for an instance’s admins

Privacy

What’s kept, and what never is.

Anonymous visitors are counted by a hash that lasts one day on one site, computed on the server. It costs some accuracy, and that’s the trade.

Kept

  • The page’s path, without its query string except utm_* tags, with emails and long tokens taken out
  • The referrer’s host, on the first page of a load
  • A country, and a coarse device, browser and system
  • The events and traits your site chooses to send
  • A hash, one per site per day

Never kept

  • The visitor’s address: neither the buffer nor the database sees it
  • The user agent
  • Any cookie: none is ever set
  • Anything in the browser before identify

Whether your site must ask for consent depends on where it runs and what it does: that decision is yours. This is general information, not legal advice.

How the privacy approach works

Where it stands

Under construction, plainly.

Works today
A first version works end to end on a test instance, with real browsers, a real assistant and five million synthetic events.
Not proven yet
  • It hasn’t collected real traffic
  • Its Vercel Queues buffer has only run against a stand-in for that service
  • Its data model may change, with no upgrade path between versions so far
  • No hosted version, and the npm package isn’t published

Don’t rely on it as your only analytics yet.

Not built
Session replay, automatic capture of every click, heatmaps, feature flags and A/B tests, surveys, account health. The list in the spec

Measured by the repo’s load test

Overview, biggest site, 90 days70 ms
Funnel, three steps, 90 days130 ms
Retention, 13 weeks150 ms
A flush of 4,500 batches4 s

5 million synthetic events over 120 days on 30 sites, on Postgres 17 limited to one CPU and 4 GB. Synthetic events, not real traffic.

Questions

The honest answers.

Is there a hosted version?

No, a hosted version isn’t available. Today you run Trailic yourself, from the repo.

Can I install it from npm?

Not yet: the package isn’t published. The library lives in the repo, in packages/trailic.

What does it cost?

Trailic has no licence fee, no seats and no credits. You pay whoever runs your app and your database, at their prices.

Does it mean no cookie banner?

Trailic sets no cookies and keeps nothing in the browser until identify. Whether your site must ask for consent depends on where it runs and what it does, and that decision is yours. This is general information, not legal advice.

Does it only work with Next.js?

The library is built for the Next.js App Router. The collector is a plain HTTP endpoint that any browser or server can post to, but the component that counts page views is for React and Next’s router.

Do I have to run it on Vercel?

No. It’s a Next.js app and a Postgres database, so anywhere that runs Node works. Away from Vercel, you point the buffer at a folder on a disk that lasts and call the two jobs on a schedule.

Why would my numbers differ from another tool’s?

A visitor counts once per site per UTC day, known bots are left out, and everyone behind one address with the same browser is one visitor, which is a known undercount.

From the blog

Notes from building it.

All posts
When analytics need consent under ePrivacy and GDPR, why no cookies isn’t the test, and each condition of the CNIL exemption. General information.
What cookieless analytics means, how six tools count people without cookies, what each loses, and why no cookies doesn’t settle the consent question.
The daily salted hash step by step, with code you can run, its error in both directions, and a plain table of what it stops and what it doesn’t.

Read it, run it, tell us what breaks.

The code is on GitHub under the AGPL-3.0. Questions and bug reports go to its issues.