Skip to content

feat(auth): add privacy-conscious signup funnel measurement - #791

Merged
unjica merged 1 commit into
developfrom
feat/privacy-signup-funnel
Oct 12, 2026
Merged

unjica merged 1 commit into
developfrom
feat/privacy-signup-funnel

Conversation

@unjica

@unjica unjica commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Changes

Extend merged first-touch signup attribution without replacing its cookie or consent mechanism. Store nullable User.signup_channel and User.first_landing_path; retain only the pathname and sanitized utm_source/utm_medium/utm_campaign query tags. Existing UTM fields and hostname-only referrer behavior remain. No browser persistence before consent; rejection deletes the cookie and the existing server action independently gates forwarding. Missing API attribution records no_consent with no landing/referrer/campaign values. Direct API attribution remains client-supplied and cannot prove consent.

After successful self-serve or invite registration, emit GA4 sign_up (method=email) only when existing consent is accepted and gtag is available. Failed registrations emit nothing. No additional tracking event, loader, public analytics endpoint, or identifier is introduced.

Add nullable Project.first_event_at, conditionally set once after accepted event, nonempty batch, new session, or error ingestion. One indexed conditional update per accepted request/batch, with no rewrite after activation. Retention leaves this project fact intact. Organization activation can be derived from the minimum project timestamp. Update privacy/cookie disclosures and reporting documentation.

Migration notes

Additive nullable columns only. Backfill earliest surviving Event.created_at, ErrorOccurrence.created_at through ErrorGroup, and Session.started_at; fall back to ApiKey.last_used_at only when raw evidence is absent. This fallback is approximate and may include non-ingest authentication. Already-retained-away history cannot be reconstructed exactly. Historical session timestamps are client-provided; future activation uses server receipt time. The backfill scans retained data and updates projects; account for database size during normal migration scheduling.

A pg_roles-guarded DO block grants analytics_ro SELECT only on the three new columns, and runs only when that role exists. No view was added; docs include independent daily stage queries. No migration, real database access, Railway action, merge, deployment or publish was performed.

Validation

  • pnpm test: 1,624 passed, 163 database integration tests skipped (API 1,152; dashboard 324; core 67; vite plugin 14; node 27; next 15; React Native 8; publish guards 17).
  • pnpm lint: passed with zero warnings.
  • pnpm build: passed across the monorepo, including dashboard production type validation and 59 generated pages.
  • API production type-check (tsc -p tsconfig.build.json --noEmit): passed.
  • Prisma generation and schema validation: passed; validation used a dummy URL and made no database connection.
  • Standalone tsc --noEmit: API has 106 diagnostics in 24 existing test files; dashboard has six diagnostics in two existing test files. Every diagnostic-bearing file is byte-identical to origin/develop; no diagnostics in changed/new files. These existing failures were not weakened or fixed out of scope.
  • Added unit coverage for classification, query stripping, consent and GA4 success/failure gating, no-consent registration, and atomic set-once behavior. Extended opt-in database integration coverage for receipt timestamp persistence/retries/raw deletion; it remains skipped without database integration enabled.
  • git diff --check and full self-review passed. Generated build changes excluded.

Reporting limits

GA4 landing traffic is consented; server signup/project/activation facts include all operational activity. Daily stage totals are not visitor-level conversion cohorts. Missing attribution is not proof of refusal; blocked/unloaded GA drops sign_up. Configure sign_up as a GA4 key event separately after deployment.

Extend consent-gated first-touch attribution with coarse channel and sanitized
landing path, and emit GA4 sign_up only after successful consented registration.
Record durable set-once project telemetry receipt timestamps, backfill surviving
historical evidence, and guard analytics_ro column grants behind role existence.
Update privacy disclosures and cover classification, consent, and activation.
@unjica
unjica merged commit 8b7dbf4 into develop Oct 12, 2026
7 checks passed
@unjica unjica mentioned this pull request Oct 12, 2026
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