rubis/apps/web/posthog-setup-report.md
ordinarthur b7ad42f3d0
All checks were successful
Build & Deploy Web / build-and-deploy (push) Successful in 43s
chore(web): commit PostHog wizard skill + report
Contexte pour les futures itérations agent : skill PostHog
integration-react-tanstack-router-file-based + rapport du wizard
(événements instrumentés, dashboards créés, next steps).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:22:49 +02:00

39 lines
3.1 KiB
Markdown

<wizard-report>
# PostHog post-wizard report
The wizard has completed a deep integration of PostHog analytics into Rubis Sur l'Ongle (React + TanStack Router, file-based routing). PostHog is initialized via `PostHogProvider` in the root layout (`__root.tsx`) and wraps the entire app. Pageviews are tracked manually on each TanStack Router navigation using a `PostHogPageview` component that subscribes to `useRouterState`. A reverse proxy for EU data (`/ingest → eu.i.posthog.com`) was added to `vite.config.ts`. Users are identified on login, signup, and SSO completion. Ten business-critical events were instrumented across 7 files. The packages `posthog-js` and `@posthog/react` have been added to `package.json` — run `pnpm install` from the monorepo root to complete the installation.
| Event | Description | File |
|---|---|---|
| `user_signed_up` | User created a new account via email/password | `src/routes/signup.tsx` |
| `user_logged_in` | User logged in via email/password (`provider: "email"`) | `src/routes/login.tsx` |
| `user_logged_in_sso` | User logged in or signed up via SSO (Google/Microsoft) | `src/routes/auth.sso.complete.tsx` |
| `invoice_uploaded` | User uploaded invoice files for OCR (`count: N`) | `src/routes/_app/factures_.import.tsx` |
| `invoice_emitted` | User emitted a native invoice (`plan_id`, `theme_slug`, `line_count`) | `src/routes/_app/factures_.nouvelle.tsx` |
| `invoice_draft_saved` | User saved a native invoice as draft (`plan_id`, `theme_slug`, `line_count`) | `src/routes/_app/factures_.nouvelle.tsx` |
| `invoice_marked_paid` | User manually marked an invoice as paid (`invoice_id`) | `src/routes/_app/factures_.$id.tsx` |
| `invoice_relance_launched` | User manually triggered the relance plan (`invoice_id`) | `src/routes/_app/factures_.$id.tsx` |
| `plan_created` | User created a relance plan (`plan_name`, `step_count`, `global_tone`) | `src/routes/_app/plans_.nouveau.tsx` |
| `checkout_started` | User initiated Stripe checkout to upgrade (`plan`, `cycle`) | `src/routes/_app/parametres_.abonnement.tsx` |
## Next steps
We've built some insights and a dashboard for you to keep an eye on user behavior, based on the events we just instrumented:
- [Analytics basics dashboard](/dashboard/683945)
- [New signups over time](/insights/7KULKkhK) — daily unique signups
- [Invoices emitted over time](/insights/jOqnJLau) — emitted vs drafts
- [Signup to invoice conversion funnel](/insights/8SHFqUIY) — core activation funnel (signup → upload → emit)
- [Checkout started by plan](/insights/0NUv6IkF) — upgrade intent broken down by Pro vs Business
- [Invoice paid vs relance launched](/insights/S5hMZkDE) — daily resolution activity
### Next action required
Run `pnpm install` from the monorepo root (`/Users/arthurbarre/dev/saas-dir/rubis`) to install `posthog-js` and `@posthog/react`.
### Agent skill
We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code. This will help ensure the model provides the most up-to-date approaches for integrating PostHog.
</wizard-report>