Skip to content

Release: PostHog revamp, Stripe fixes, unified site header - #17

Merged
maxjneto merged 11 commits into
mainfrom
develop
Nov 5, 2026
Merged

maxjneto merged 11 commits into
mainfrom
develop

Conversation

@maxjneto

@maxjneto maxjneto commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Brings #16 to main: PostHog revamp (consent-aware events, recording masks, /ingest proxy, error tracking, migration 004), Stripe fixes (no double subscription, allowance follows the plan, provider errors as 502) and the unified site header, footer and pt-BR legal pages.

Deploy: backup before (migration 004 runs on start); Caddy /ingest is already live on the VPS.

…captures write through

marketing/ (capture, compositor, renders) stays local and is ignored. __previewWrite only exists in the preview build (npm run dev:preview).
…e, Stripe calls off the event loop

- checkout refuses people who already subscribe (409, manage it in the portal)
- an active subscription on a price we don't know grants Pro instead of Free
- Stripe SDK calls run in the threadpool
- billing page asks for the plan again after checkout until the webhook lands
…, flush on shutdown

- consent from an earlier visit counts, so identify runs after a reload
- capture_pageview: history_change for the SPA
- backend PostHog client flushes its queue when the app stops
…ents by object and action

Privacy (the policy promised it, the layout editor did not do it):
- layout pages render in same-origin iframes: maskForRecording() puts data-ph-mask
  on their <body>, so rrweb masks the text and blocks the images inside
- slide thumbnails (SVG data URIs holding the slide's text) are blocked
- side panels, titles, presence, comments and in-place editing are masked;
  names that sit in attributes are ph-no-capture; autocapture skips content areas
- public-link tokens are scrubbed from every URL property; public pages never record

Foundation: src/analytics (init, track with document context, consent, identity),
environment/app_version/locale on every event, nothing sent from localhost unless
VITE_POSTHOG_DEV=1, heatmaps, web vitals and exception capture after consent. The
cookie choice is also sent to the account so server events can follow it.

Events: the server now records what used to be duplicated here (document created,
reviews, versions, comments, themes); "Reviewed" goes to the backend. New: style,
looks, header/footer, shortcuts, undo/redo, collaboration, marketing CTAs, snippets
and the demo.
…, error tracking

- users.analytics_consent (migration 004) set by PATCH /users/me from the banner
- accepted: the Clerk id and $set (plan); declined or never answered: a stable
  anon_<HMAC> pseudonym with no person profile (POSTHOG_ANON_SALT)
- events renamed to object_action with `source` (agent | person) and
  `document_mode`: document_created (one event for Markdown, layout, app and MCP),
  agent_changes_reviewed (north star, new POST /layout/reviewed), version_*,
  comment_*, document_shared/moved/published/exported, folder_created,
  checkout_started, subscription_started/canceled
- mcp_api_request only on failure (agent_request_failed); render_page counted once
- unhandled errors go to PostHog error tracking, never tied to a person
- MCP tool calls report their toolset
- funnel script on the new server-only events, production only
…alogue

- Caddy: /ingest -> PostHog, so blockers don't drop a developer audience
  (validated with caddy:2-alpine)
- VITE_APP_VERSION / APP_VERSION from the git SHA; VITE_POSTHOG_UI_HOST
- docs/architecture/analytics.md: sources, consent and identity, what is never
  sent, the event catalogue and configuration
…ripe refuses

- the "already subscribed" check relied on the local plan, which only changes when
  the webhook lands; a late or lost webhook let a second payment open a second
  subscription. Checkout now lists the customer's subscriptions in Stripe first,
  refuses with 409 and heals the plan if one is still paid for
- Stripe errors on checkout and portal (e.g. a restricted key without Customer
  Portal: Write) are logged with Stripe's message and answered with a clear 502
…sent to manage, not to pay again

- on a plan change the remaining document creations move by the difference
  between the allowances (free → Pro: 15 left becomes 100 left; what was used
  still counts; back to free never goes negative). Before, a new subscriber kept
  the free 15 out of 100 until Sunday's reset
- the pricing page knows the signed-in plan: a subscriber sees "Your plan ·
  Manage" (to /billing) instead of "Get Pro"; a 409 from checkout goes to
  /billing instead of a generic error
The banner only calls setConsent when there is no choice yet, so someone who
accepted on an earlier visit stayed opted out of PostHog for good.
…ditor, legal pages in Portuguese

SiteHeader replaces MarketingNav and TopBar: the links depend only on being
signed in or not. Privacy, terms and contact share one shell, with pt-BR texts
next to the English ones.
PostHog revamp, Stripe fixes, unified site header
@maxjneto
maxjneto merged commit 7c8ffd8 into main Nov 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant