feat(store): add PostHog analytics and conversion tracking #150

Merged
yuris merged 2 commits from feat/149-posthog-analytics into main 2026-09-29 12:22:37 +00:00
Owner

Closes #149.

What changed

  • apps/store: added posthog-js, PostHogProvider, and analytics.ts helper
  • apps/store/app/cart/cart-view.tsx: track whatsapp_checkout_clicked on checkout button
  • apps/store/app/products/[slug]/add-to-cart.tsx: track add_to_cart on adding item
  • .forgejo/workflows/deploy-store.yml: pass PostHog env vars to build step
  • secretspec.toml & apps/store/.env.example: documented PostHog env keys

Verified

  • pnpm --filter garage-store test (all 118 tests pass)
  • pnpm --filter garage-store lint (0 findings)
  • pnpm --filter garage-store exec tsc --noEmit (clean typecheck)

Deviations

none

Closes #149. ## What changed - `apps/store`: added `posthog-js`, `PostHogProvider`, and `analytics.ts` helper - `apps/store/app/cart/cart-view.tsx`: track `whatsapp_checkout_clicked` on checkout button - `apps/store/app/products/[slug]/add-to-cart.tsx`: track `add_to_cart` on adding item - `.forgejo/workflows/deploy-store.yml`: pass PostHog env vars to build step - `secretspec.toml` & `apps/store/.env.example`: documented PostHog env keys ## Verified - `pnpm --filter garage-store test` (all 118 tests pass) - `pnpm --filter garage-store lint` (0 findings) - `pnpm --filter garage-store exec tsc --noEmit` (clean typecheck) ## Deviations none
feat(store): add PostHog analytics and conversion tracking
Some checks failed
Checks / test @garage/catalog (pull_request) Successful in 1m17s
Checks / test garage (pull_request) Successful in 1m28s
Checks / lint (biome) (pull_request) Has been cancelled
Checks / typecheck apps/store (pull_request) Has been cancelled
Checks / typecheck apps/management (pull_request) Has been cancelled
Checks / test garage-store (pull_request) Successful in 1m20s
17e20656dc
yuris left a comment

VERDICT: request-changes
apps/store/app/cart/cart-view.tsx:L449: blocker: PostHog autocapture records the checkout link href, which contains the customer destination and free-text note in the WhatsApp message. Add ph-no-capture to this link (the explicit conversion event still fires), or disable autocapture in PostHog init.
apps/store/app/posthog-provider.tsx:L16: should: Session replay can start when the PostHog project enables recording because the SDK defaults to not disabling it, contrary to the decision to keep replay off. Add disable_session_recording: true to the init options.
The other requested dependency, env, CI build wiring, pageview configuration, SSR guard/test, and conversion event hooks are present. The store test, lint, and typecheck CI statuses were pending at review time.

VERDICT: request-changes apps/store/app/cart/cart-view.tsx:L449: blocker: PostHog autocapture records the checkout link href, which contains the customer destination and free-text note in the WhatsApp message. Add ph-no-capture to this link (the explicit conversion event still fires), or disable autocapture in PostHog init. apps/store/app/posthog-provider.tsx:L16: should: Session replay can start when the PostHog project enables recording because the SDK defaults to not disabling it, contrary to the decision to keep replay off. Add disable_session_recording: true to the init options. The other requested dependency, env, CI build wiring, pageview configuration, SSR guard/test, and conversion event hooks are present. The store test, lint, and typecheck CI statuses were pending at review time.
fix(store): add ph-no-capture to checkout link and disable session recording
Some checks failed
Checks / test @garage/catalog (pull_request) Has been cancelled
Checks / test garage (pull_request) Has been cancelled
Checks / test garage-store (pull_request) Has been cancelled
Checks / typecheck apps/management (pull_request) Has been cancelled
Checks / typecheck apps/store (pull_request) Has been cancelled
Checks / lint (biome) (pull_request) Has been cancelled
1b5e259f02
Author
Owner

Round 1 addressed:

  • Added ph-no-capture class to the WhatsApp checkout link in apps/store/app/cart/cart-view.tsx to prevent autocapture of customer destination and note in the URL.
  • Added disable_session_recording: true to posthog.init options in apps/store/app/posthog-provider.tsx to ensure session replay remains disabled.
  • Pushed back on: none.
  • Re-verified: pnpm --filter garage-store test (all 118 pass), pnpm --filter garage-store lint (0 findings), pnpm --filter garage-store exec tsc --noEmit (clean).
Round 1 addressed: - Added `ph-no-capture` class to the WhatsApp checkout link in `apps/store/app/cart/cart-view.tsx` to prevent autocapture of customer destination and note in the URL. - Added `disable_session_recording: true` to `posthog.init` options in `apps/store/app/posthog-provider.tsx` to ensure session replay remains disabled. - Pushed back on: none. - Re-verified: `pnpm --filter garage-store test` (all 118 pass), `pnpm --filter garage-store lint` (0 findings), `pnpm --filter garage-store exec tsc --noEmit` (clean).
yuris left a comment

VERDICT: approve
Round 1 fixes are present in commit 1b5e259: the WhatsApp checkout link has ph-no-capture, preserving the explicit conversion event without autocapturing its URL, and PostHog explicitly disables session recording. The PR diff retains the issue #149 wiring and event hooks. The author reports 118 passing store tests and clean lint/typecheck; Forgejo checks for this head are still pending.

VERDICT: approve Round 1 fixes are present in commit 1b5e259: the WhatsApp checkout link has ph-no-capture, preserving the explicit conversion event without autocapturing its URL, and PostHog explicitly disables session recording. The PR diff retains the issue #149 wiring and event hooks. The author reports 118 passing store tests and clean lint/typecheck; Forgejo checks for this head are still pending.
yuris force-pushed feat/149-posthog-analytics from 1b5e259f02
Some checks failed
Checks / test @garage/catalog (pull_request) Has been cancelled
Checks / test garage (pull_request) Has been cancelled
Checks / test garage-store (pull_request) Has been cancelled
Checks / typecheck apps/management (pull_request) Has been cancelled
Checks / typecheck apps/store (pull_request) Has been cancelled
Checks / lint (biome) (pull_request) Has been cancelled
to 1d6d1b9e58
All checks were successful
Checks / test @garage/catalog (pull_request) Successful in 1m17s
Checks / test garage (pull_request) Successful in 1m27s
Checks / test garage-store (pull_request) Successful in 1m22s
Checks / typecheck apps/management (pull_request) Successful in 1m43s
Checks / lint (biome) (pull_request) Successful in 12s
Checks / typecheck apps/store (pull_request) Successful in 1m27s
2026-09-29 12:22:15 +00:00
Compare
Author
Owner

Note: Merging to main deploys the store via .

Note: Merging to main deploys the store via .
yuris merged commit cdf9ef4dde into main 2026-09-29 12:22:37 +00:00
yuris deleted branch feat/149-posthog-analytics 2026-09-29 12:22:38 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage!150
No description provided.