Skip to content
Source
Sign inSign up
TanStack/alt-cli

feat: add posthog integration and analytics category on create/builder #3

Openantoniobfm(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/3/headopened

Showing 10 changed files with 119 additions and 0 deletions (loading 7).

x
0 of 10 viewed, 10 left
5 additions and 0 deletions.changeset/posthog-integration.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+"@tanstack/cli": minor
+---
+​
+Add analytics category and posthog integration
21 additions and 0 deletionsintegrations/posthog/assets/src/integrations/posthog/provider.tsxAdded
View file
@@ -0,0 +1,21 @@
+import posthog from 'posthog-js'
+import { PostHogProvider as BasePostHogProvider } from '@posthog/react'
+import type { ReactNode } from 'react'
+​
+if (typeof window !== 'undefined' && import.meta.env.VITE_POSTHOG_KEY) {
+ posthog.init(import.meta.env.VITE_POSTHOG_KEY, {
+ api_host:
+ import.meta.env.VITE_POSTHOG_HOST || 'https://us.i.posthog.com',
+ person_profiles: 'identified_only',
+ capture_pageview: false,
+ defaults: '2025-11-30',
+ })
+}
+​
+interface PostHogProviderProps {
+ children: ReactNode
+}
+​
+export function PostHogProvider({ children }: PostHogProviderProps) {
+ return <BasePostHogProvider client={posthog}>{children}</BasePostHogProvider>
+}