rubis/apps/landing/posthog-setup-report.md
ordinarthur 5f88a6411e
All checks were successful
Build & Deploy Landing / build-and-deploy (push) Successful in 1m0s
feat(landing): instrumentation PostHog (Astro client)
Setup PostHog côté landing — loader inline dans Layout.astro + tracking
de 5 events business côté browser :
- blog_article_viewed / blog_cta_clicked (funnel blog → app)
- pricing_pro_cta_clicked / pricing_plan_selected (intent upgrade)
- signup_cta_clicked (CTA hero/header/finalCTA, location-aware)

Vars PUBLIC_POSTHOG_* inlinées au build via build-arg CI
(POSTHOG_PROJECT_TOKEN, partagé avec apps/web). Token public phc_*,
safe à bake dans le bundle.

Au passage : supprime posthog-server.ts laissé par le wizard
(dead code, importait posthog-node qui n'est pas dans les deps).

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

3.0 KiB

# PostHog post-wizard report

The wizard has completed a deep integration of PostHog analytics into the Rubis landing page (apps/landing, Astro 6 SSR).

What was done

  • src/components/posthog.astro — PostHog client-side snippet component, initialised from env vars, injected into all pages via the shared layout.
  • src/lib/posthog-server.ts — Server-side PostHog singleton (posthog-node), ready for use in any future API routes.
  • src/layouts/Layout.astro — Added <PostHog /> component to <head> so all pages (home, blog, legal, changelog) are covered.
  • src/pages/index.astro<script is:inline> block tracks CTA clicks (with location context), Pro plan CTA, Free/Business plan selections, and FAQ accordion opens.
  • src/pages/blog/[slug].astro<script is:inline define:vars> block tracks blog article views (top of funnel) and in-article CTA clicks, passing slug and title as properties.
  • apps/landing/.envPUBLIC_POSTHOG_PROJECT_TOKEN, PUBLIC_POSTHOG_HOST, POSTHOG_PROJECT_TOKEN, POSTHOG_HOST written and .gitignore-covered.

⚠️ Action required

Run the following from the monorepo root to install the packages (the sandbox could not write to the root lockfile):

cd /Users/arthurbarre/dev/saas-dir/rubis
pnpm add posthog-js posthog-node --filter @rubis/landing

Events

Event Description File
signup_cta_clicked User clicked a CTA button linking to app.rubis.pro (Hero, Header, or FinalCTA) src/pages/index.astro
pricing_pro_cta_clicked User clicked the Pro plan CTA "Commencer l'essai 30 jours" src/pages/index.astro
pricing_plan_selected User clicked a Free or Business plan card src/pages/index.astro
faq_item_opened User expanded a FAQ accordion item src/pages/index.astro
blog_article_viewed User loaded a blog article page (top of blog conversion funnel) src/pages/blog/[slug].astro
blog_cta_clicked User clicked the in-article CTA block linking to app.rubis.pro src/pages/blog/[slug].astro

Next steps

We've built a dashboard and 5 insights to monitor landing page performance:

Agent skill

We've left an agent skill folder in your project at .claude/skills/integration-astro-ssr/. 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.