From 3982216c6084aa269493fd59e07949b4a5956ee7 Mon Sep 17 00:00:00 2001 From: Guilherme Rodrigues Date: Wed, 17 Jun 2026 09:40:20 -0300 Subject: [PATCH] analytics: pin cross_subdomain_cookie for the unified onboarding funnel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of unifying deco's acquisition → signup funnel into one PostHog project (Option A). studio.decocms.com and www.decocms.com share the `.decocms.com` root domain, so a single PostHog project + a root-scoped cookie makes a visitor the SAME person across the landing and the app — no manual cross-project stitching. Studio already runs on the target project; this just pins `cross_subdomain_cookie: true` (posthog-js' default) so it can't silently regress and break cross-domain identity. The matching change lands on the landing (deco-sites/decocms), which must be pointed at this same project key. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- apps/mesh/src/web/lib/posthog-client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/mesh/src/web/lib/posthog-client.ts b/apps/mesh/src/web/lib/posthog-client.ts index a3f176bd95..2c9aa7150f 100644 --- a/apps/mesh/src/web/lib/posthog-client.ts +++ b/apps/mesh/src/web/lib/posthog-client.ts @@ -21,6 +21,13 @@ export function initPostHog(key: string, host: string) { if (initialized || typeof window === "undefined") return; posthog.init(key, { api_host: host, + // Persist the PostHog cookie on the `.decocms.com` root domain so a visitor + // is the SAME person across www.decocms.com (landing) and + // studio.decocms.com (this app). Required for the unified + // acquisition → signup funnel — both surfaces must share ONE project key + // for the cookie to match. posthog-js defaults this to true; pinned + // explicitly so it can't silently regress and break cross-domain identity. + cross_subdomain_cookie: true, capture_pageview: "history_change", capture_pageleave: true, autocapture: true,