feat(store): add PostHog analytics and conversion tracking #150
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/149-posthog-analytics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #149.
What changed
apps/store: addedposthog-js,PostHogProvider, andanalytics.tshelperapps/store/app/cart/cart-view.tsx: trackwhatsapp_checkout_clickedon checkout buttonapps/store/app/products/[slug]/add-to-cart.tsx: trackadd_to_carton adding item.forgejo/workflows/deploy-store.yml: pass PostHog env vars to build stepsecretspec.toml&apps/store/.env.example: documented PostHog env keysVerified
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
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.
Round 1 addressed:
ph-no-captureclass to the WhatsApp checkout link inapps/store/app/cart/cart-view.tsxto prevent autocapture of customer destination and note in the URL.disable_session_recording: truetoposthog.initoptions inapps/store/app/posthog-provider.tsxto ensure session replay remains disabled.pnpm --filter garage-store test(all 118 pass),pnpm --filter garage-store lint(0 findings),pnpm --filter garage-store exec tsc --noEmit(clean).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.1b5e259f021d6d1b9e58Note: Merging to main deploys the store via .