What to Measure, and What Not To: Adding Analytics to Ceiba
Until late August, Ceiba had no product analytics running anywhere. posthog-js had been sitting on the landing site for a while, with a consent banner and an honest line in the Privacy Policy, but nobody had ever set an analytics key in production. The whole thing was inert. Nothing got collected, ever.
I noticed because a paid-acquisition test I'd proposed got blocked. I had no way to tell whether a click turned into a signed-up user, never mind an active one, and you can't run that test on vibes. So I had to decide what to measure and, just as deliberately, what to leave alone.
I got the scope wrong, twice#
Underneath every real decision sat a bad assumption. I'd convinced myself that the jump from the marketing site (useceiba.com) to the Control Plane console (app.useceiba.com) crossed a domain boundary, which would mean I could only ever measure click-throughs, never signups or activation. I said this out loud twice before catching it.
It's wrong. Same registrable domain, different subdomains, and that difference decides everything. PostHog's cross-subdomain cookie logic takes the last two labels of the hostname and checks them against a short blocklist of shared hosting domains. useceiba.com isn't on it, so the identity cookie gets written at the domain level and both subdomains can read it. No query parameters, no manual aliasing, none of the identity-bridging a real cross-domain funnel would need.
I only found out by reading posthog-js's compiled source instead of trusting the docs, or my own earlier summary of them:
For useceiba.com that returns true, so an anonymous visitor's distinct_id already survives the hop to the console before I'd written a line of new code. The bad assumption had made the achievable scope look much smaller than it was. That's a sneaky way to be wrong, because nothing ever throws an error. It just quietly talks you out of ambitious work.
Three stages, not four#
The full funnel I eventually want looks like this:
useceiba.com → app.useceiba.com → project created → first authorize
I shipped the first three and held back the last one.
The three that are live: landing CTA click, signup completed, first project created. They're stitched into one identity through the shared cookie and an explicit identify() call at signup.
The fourth, first successful API authorization through Runtime, I left out on purpose, for reasons that only work together. Runtime's authorization endpoint is the hottest path in the product, since every protected request from a customer's backend goes through it, and I didn't want analytics capture anywhere near something that's deliberately kept narrow and fast. Event volume there is also orders of magnitude higher than at the other stages, and volume is what the vendor bills on. On top of that, Runtime authorizes a project, not a person, so tying an event back to the owning account needs a lookup that path doesn't do today. That means either a database read on the hottest path in the system, or a design that stitches identity later, off to the side. Neither is a call to make in passing, or to bundle into the same change as the first three stages.
I'd rather say the gap out loud than let a three-stage funnel sound more complete than it is. Signup and project creation are steps toward a customer's API actually being protected. They aren't that. Everything I can measure today tells me whether people are interested, and none of it tells me whether anyone gets value. That's a common shape for product analytics: the events that are easy to capture sit at the front of the funnel, and the ones that matter sit deep in the product, behind the hardest engineering. Stage four isn't scheduled yet. It becomes a real follow-on once the first three have data worth extending.
A judgment call that isn't really technical#
The console doesn't get a consent banner of its own. The landing site's analytics stay as they were: off by default, behind an accept/decline banner, disclosed in the Privacy Policy. The console is different. A cookie banner in front of an authenticated customer who's already paying costs real UX, and the telemetry there is product usage on an account they hold, not anonymous visitor tracking. The two are commonly treated under different legal bases, and I took that position on purpose instead of reusing the same banner everywhere by default.
There's a side effect. Because the identity cookie is shared, a consent choice on the landing site can in principle follow someone into the console. Decline on the marketing site and you may arrive at the console still opted out. Accept, and you may arrive opted in to a surface nobody separately asked you about. Since the console runs on a different legal basis, this matters less than it would if both surfaces shared one mechanism. Still, two decisions I reasoned about independently are now interacting, and I'd rather write that down than leave it implicit.
Going live broke something the same day#
The key went in, the taxonomy shipped, and almost right away PostHog's Activity view showed events it shouldn't have: URLs on localhost:3000, mixed in with real traffic from both subdomains. My own local testing was landing in the production project. Every funnel and conversion number was contaminated from day one, and the noise counted toward the bill.
The obvious guard is NODE_ENV === "production", and it's wrong. next start against a local production build sets NODE_ENV to "production", and so do Vercel preview deployments. My local smoke tests run next start. That check would have left the exact hole it was supposed to close.
So the gate is on hostname instead:
I tested it against nine hostnames before shipping, because a mistake here fails silently. A broken API endpoint pages you, but a broken analytics gate just hands you numbers that look fine. The apex, www, app and docs all resolve true. localhost, 127.0.0.1, any *.vercel.app preview, a lookalike domain, and a suffix-attack case like useceiba.com.evil.net all resolve false. That last one is why I didn't use .includes("useceiba.com"), which would have waved it straight through.
The same week turned up a separate bug in checkout: a test-mode Stripe price id had leaked into the production plan catalog. Different system, same lesson. Something narrow got through because nothing validated it at the boundary where it mattered.
Checking that it actually works#
The whole point of fixing the cross-subdomain assumption was that identity should survive the hop without extra plumbing. I'd only argued that from source code, so I checked. PostHog's Activity view now shows pageviews from app.useceiba.com/login carrying a real Clerk user id as the distinct_id. identify() fires, the cookie crosses over in practice, and the funnel stitches the way the design said it would.
Session recording is off, and that's deliberate. Full DOM-replay recording is free up to a decent volume, but it carries a measured 20-25% CPU cost while it's recording, which fails the "no latency increase" bar I set for myself. Autocapture and heatmaps stay on. Heatmaps are derived from data I'm already capturing, so they cost nothing extra.
What's still open#
The old localhost events are still in the project. The hostname fix stopped new ones from arriving but didn't remove the ones already there, so a one-off cleanup is worth doing if the early counts matter.
Stage four is the bigger item. It's the one that would tell me whether the product gets used and not just signed up for, and I'd rather build it once the first three stages have real data behind them than guess at its shape now.
A week before this went live, none of it was measurable. Now it's designed, running, and it already caught two things going wrong in its first week. I'm not pleased about the bugs. I'm pleased they showed up immediately, and not three months from now when somebody asks why the numbers never made sense.