feat(store): add PostHog analytics and conversion tracking #149
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Goal
Integrate PostHog product analytics into the static export store (
apps/store), track client route changes and core conversion events (add_to_cart,whatsapp_checkout_clicked), and configure secret passing for CI builds.Acceptance Criteria
posthog-jsdependency toapps/storewithcore-js: falseinpnpm-workspace.yamlallowBuilds.NEXT_PUBLIC_POSTHOG_KEYandNEXT_PUBLIC_POSTHOG_HOSTtosecretspec.toml(default and dev profiles) andapps/store/.env.example.NEXT_PUBLIC_POSTHOG_KEYandNEXT_PUBLIC_POSTHOG_HOSTin theBuildstep in.forgejo/workflows/deploy-store.yml.<PostHogProvider />inapps/store/app/layout.tsxwithperson_profiles: "identified_only"andcapture_pageview: "history_change". Must safely no-op if key is absent.trackEventhelper inapps/store/lib/analytics.tsthat safely no-ops in non-browser/SSR environments, verified by a unit test.whatsapp_checkout_clickedon the checkout link inapps/store/app/cart/cart-view.tsx.add_to_cartinapps/store/app/products/[slug]/add-to-cart.tsx.pnpm --filter garage-store test,pnpm --filter garage-store lint, andpnpm --filter garage-store exec tsc --noEmit.