vybekiit 0.7.26 → 0.7.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +3910 -1300
- package/dist/global-guidance/language.md +443 -0
- package/dist/global-skills/add-ai/SKILL.md +1 -1
- package/dist/global-skills/add-analytics/SKILL.md +1 -1
- package/dist/global-skills/add-blog/SKILL.md +1 -1
- package/dist/global-skills/add-crud/SKILL.md +1 -1
- package/dist/global-skills/add-files/SKILL.md +1 -1
- package/dist/global-skills/add-images/SKILL.md +1 -1
- package/dist/global-skills/add-language/SKILL.md +1 -1
- package/dist/global-skills/add-notifications/SKILL.md +1 -1
- package/dist/global-skills/add-realtime/SKILL.md +1 -1
- package/dist/global-skills/add-route/SKILL.md +1 -1
- package/dist/global-skills/add-search/SKILL.md +1 -1
- package/dist/global-skills/add-signin/SKILL.md +1 -1
- package/dist/global-skills/add-teams/SKILL.md +1 -1
- package/dist/global-skills/add-upload/SKILL.md +1 -1
- package/dist/global-skills/aws-cdk/SKILL.md +19 -5
- package/dist/global-skills/aws-cdk/references/fast-deployments.md +191 -0
- package/dist/global-skills/aws-cdk/references/troubleshooting-deployment.md +16 -0
- package/dist/global-skills/aws-cloudformation/SKILL.md +16 -26
- package/dist/global-skills/aws-cloudformation/references/check-cloudformation-template-compliance.script.md +7 -3
- package/dist/global-skills/aws-cloudformation/references/cloudformation-language-server.md +177 -0
- package/dist/global-skills/aws-cloudformation/references/cloudformation-pre-deploy-validation.script.md +8 -2
- package/dist/global-skills/aws-cloudformation/references/persist-template-context.script.md +5 -8
- package/dist/global-skills/aws-cloudformation/references/retrieve-template-context.script.md +1 -1
- package/dist/global-skills/aws-cloudformation/references/security-considerations.md +51 -0
- package/dist/global-skills/aws-cloudformation/references/troubleshoot-failed-stack.script.md +138 -0
- package/dist/global-skills/aws-cloudformation/references/{validate-cloudformation-template.script.md → validate-with-cfn-lint.script.md} +15 -27
- package/dist/global-skills/aws-cloudformation/references/validate-with-cloudformation-validate.script.md +181 -0
- package/dist/global-skills/aws-cloudformation/references/validation-tool-selection.md +44 -0
- package/dist/global-skills/aws-serverless/SKILL.md +9 -1
- package/dist/global-skills/aws-serverless/references/architecture.md +3 -1
- package/dist/global-skills/aws-serverless/references/lambda.md +3 -1
- package/dist/global-skills/aws-serverless/references/orchestration.md +1 -0
- package/dist/global-skills/back-up-my-code/SKILL.md +1 -1
- package/dist/global-skills/better-auth-best-practices/SKILL.md +18 -8
- package/dist/global-skills/buy-domain/SKILL.md +1 -1
- package/dist/global-skills/check-safety/SKILL.md +1 -1
- package/dist/global-skills/configure-capabilities/SKILL.md +1 -1
- package/dist/global-skills/connect-account/SKILL.md +1 -1
- package/dist/global-skills/connect-account-backend/SKILL.md +1 -1
- package/dist/global-skills/design-my-data/SKILL.md +1 -1
- package/dist/global-skills/doctor/SKILL.md +1 -1
- package/dist/global-skills/eas-app-stores/SKILL.md +31 -15
- package/dist/global-skills/eas-app-stores/agents/openai.yaml +2 -2
- package/dist/global-skills/eas-app-stores/references/ios-app-store.md +37 -32
- package/dist/global-skills/eas-app-stores/references/native-ios.md +167 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +3 -7
- package/dist/global-skills/eas-app-stores/references/testflight.md +39 -35
- package/dist/global-skills/eas-simulator/SKILL.md +48 -26
- package/dist/global-skills/eas-simulator/references/controllers.md +32 -3
- package/dist/global-skills/eas-simulator/references/run-your-app.md +34 -4
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -4
- package/dist/global-skills/eas-update/SKILL.md +146 -0
- package/dist/global-skills/eas-update/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-animation/RECIPES.md +2 -2
- package/dist/global-skills/expo-animation/SKILL.md +9 -2
- package/dist/global-skills/expo-brownfield/SKILL.md +18 -11
- package/dist/global-skills/expo-brownfield/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-brownfield/references/brownfield-integrated.md +94 -69
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +40 -42
- package/dist/global-skills/expo-brownfield/references/comparison.md +5 -5
- package/dist/global-skills/expo-brownfield/references/feature-integration.md +163 -0
- package/dist/global-skills/expo-brownfield/references/troubleshooting.md +17 -17
- package/dist/global-skills/expo-brownfield/references/version-compatibility.md +40 -0
- package/dist/global-skills/expo-data-fetching/SKILL.md +27 -6
- package/dist/global-skills/expo-design-system/SKILL.md +27 -7
- package/dist/global-skills/expo-design-system/references/audit.md +7 -2
- package/dist/global-skills/expo-design-system/references/native-slop.md +74 -0
- package/dist/global-skills/expo-examples/SKILL.md +0 -1
- package/dist/global-skills/expo-examples/references/catalog.md +1 -1
- package/dist/global-skills/expo-migrate-module/SKILL.md +21 -10
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +80 -23
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +162 -11
- package/dist/global-skills/expo-native-ui/SKILL.md +25 -16
- package/dist/global-skills/expo-native-ui/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-native-ui/references/controls.md +5 -46
- package/dist/global-skills/expo-native-ui/references/icons.md +21 -2
- package/dist/global-skills/expo-native-ui/references/media.md +15 -20
- package/dist/global-skills/expo-native-ui/references/visual-effects.md +12 -11
- package/dist/global-skills/expo-overview/SKILL.md +17 -12
- package/dist/global-skills/expo-router/SKILL.md +5 -3
- package/dist/global-skills/expo-router/references/tabs.md +5 -5
- package/dist/global-skills/expo-upgrade/SKILL.md +3 -1
- package/dist/global-skills/expo-web-to-native/references/false-friends.md +2 -2
- package/dist/global-skills/expo-web-to-native/references/native-patterns.md +1 -1
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +13 -16
- package/dist/global-skills/firebase-ai-logic-basics/references/ios_setup.md +4 -5
- package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_android.md +4 -4
- package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_web.md +3 -3
- package/dist/global-skills/firebase-auth-basics/SKILL.md +11 -6
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_android.md +4 -5
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_web.md +3 -3
- package/dist/global-skills/firebase-auth-basics/references/flutter_setup.md +24 -25
- package/dist/global-skills/firebase-auth-basics/references/security_rules.md +4 -2
- package/dist/global-skills/firebase-crashlytics/references/android_setup.md +7 -4
- package/dist/global-skills/firebase-crashlytics/references/ios_setup.md +2 -3
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -1
- package/dist/global-skills/firebase-data-connect/examples.md +4 -4
- package/dist/global-skills/firebase-data-connect/reference/config.md +5 -4
- package/dist/global-skills/firebase-data-connect/reference/realtime.md +1 -2
- package/dist/global-skills/firebase-data-connect/reference/sdk_flutter.md +2 -2
- package/dist/global-skills/firebase-data-connect/reference/sdk_ios.md +2 -2
- package/dist/global-skills/firebase-data-connect/reference/sdk_web.md +17 -6
- package/dist/global-skills/firebase-data-connect/reference/security.md +5 -5
- package/dist/global-skills/firebase-data-connect/templates.md +2 -1
- package/dist/global-skills/firebase-firestore/SKILL.md +20 -8
- package/dist/global-skills/firebase-firestore/references/enterprise/android_sdk_usage.md +5 -4
- package/dist/global-skills/firebase-firestore/references/enterprise/data_model.md +12 -3
- package/dist/global-skills/firebase-firestore/references/enterprise/indexes.md +16 -18
- package/dist/global-skills/firebase-firestore/references/enterprise/provisioning.md +1 -1
- package/dist/global-skills/firebase-firestore/references/enterprise/python_sdk_usage.md +5 -1
- package/dist/global-skills/firebase-firestore/references/enterprise/web_sdk_usage.md +7 -7
- package/dist/global-skills/firebase-firestore/references/standard/android_sdk_usage.md +5 -5
- package/dist/global-skills/firebase-firestore/references/standard/flutter_setup.md +4 -4
- package/dist/global-skills/firebase-firestore/references/standard/indexes.md +16 -18
- package/dist/global-skills/firebase-firestore/references/standard/provisioning.md +1 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +0 -5
- package/dist/global-skills/firebase-remote-config-basics/references/android_setup.md +36 -8
- package/dist/global-skills/firebase-remote-config-basics/references/ios_setup.md +1 -7
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +17 -6
- package/dist/global-skills/{firebase-firestore/references/standard/security_rules.md → firestore-rules-creation/SKILL.md} +24 -13
- package/dist/global-skills/go-live/SKILL.md +1 -1
- package/dist/global-skills/grow-my-customers/SKILL.md +23 -0
- package/dist/global-skills/harden/SKILL.md +1 -1
- package/dist/global-skills/instrument-feature-flags/SKILL.md +25 -25
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +141 -285
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -15
- package/dist/global-skills/instrument-feature-flags/references/api.md +4 -11
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +1 -13
- package/dist/global-skills/instrument-feature-flags/references/django.md +14 -27
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +20 -79
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +1 -9
- package/dist/global-skills/instrument-feature-flags/references/flask.md +13 -13
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +3 -24
- package/dist/global-skills/instrument-feature-flags/references/go.md +3 -15
- package/dist/global-skills/instrument-feature-flags/references/ios.md +4 -17
- package/dist/global-skills/instrument-feature-flags/references/java.md +5 -13
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +13 -17
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +25 -32
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +8 -15
- package/dist/global-skills/instrument-feature-flags/references/php.md +1 -15
- package/dist/global-skills/instrument-feature-flags/references/python.md +2 -15
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +13 -15
- package/dist/global-skills/instrument-feature-flags/references/react.md +17 -21
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +37 -83
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +2 -15
- package/dist/global-skills/instrument-feature-flags/references/rust.md +13 -25
- package/dist/global-skills/instrument-feature-flags/references/usage.md +14 -63
- package/dist/global-skills/instrument-feature-flags/references/web.md +9 -14
- package/dist/global-skills/instrument-product-analytics/SKILL.md +29 -29
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-static.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-view-transitions.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/android.md +72 -107
- package/dist/global-skills/instrument-product-analytics/references/angular.md +26 -28
- package/dist/global-skills/instrument-product-analytics/references/astro.md +13 -24
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +45 -63
- package/dist/global-skills/instrument-product-analytics/references/django.md +14 -27
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +20 -79
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +47 -49
- package/dist/global-skills/instrument-product-analytics/references/flask.md +13 -13
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +60 -90
- package/dist/global-skills/instrument-product-analytics/references/go.md +17 -56
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +15 -15
- package/dist/global-skills/instrument-product-analytics/references/ios.md +11 -15
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +13 -17
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +25 -32
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +13 -27
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +14 -28
- package/dist/global-skills/instrument-product-analytics/references/php.md +33 -84
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +229 -9
- package/dist/global-skills/instrument-product-analytics/references/python.md +415 -106
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +161 -155
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +12 -33
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +15 -33
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +12 -33
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +26 -41
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +37 -83
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +48 -108
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +18 -24
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +17 -19
- package/dist/global-skills/instrument-product-analytics/references/usage.md +14 -63
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +29 -28
- package/dist/global-skills/manifest.json +8 -2
- package/dist/global-skills/mongodb-search-and-ai/SKILL.md +28 -37
- package/dist/global-skills/mongodb-search-and-ai/references/automated-embedding.md +438 -0
- package/dist/global-skills/mongodb-search-and-ai/references/hybrid-search.md +60 -4
- package/dist/global-skills/mongodb-search-and-ai/references/vector-search.md +46 -108
- package/dist/global-skills/neon/SKILL.md +207 -213
- package/dist/global-skills/neon/references/auth.md +12 -0
- package/dist/global-skills/neon/references/claimable-neon.md +10 -14
- package/dist/global-skills/neon/references/function-triggers.md +53 -0
- package/dist/global-skills/neon/references/logs-loki.md +61 -0
- package/dist/global-skills/neon/references/parse-env.md +32 -0
- package/dist/global-skills/neon/references/sdk.md +7 -0
- package/dist/global-skills/neon-ai-gateway/SKILL.md +14 -16
- package/dist/global-skills/neon-auth/SKILL.md +155 -0
- package/dist/global-skills/neon-auth/references/managed-auth.md +173 -0
- package/dist/global-skills/neon-auth/references/self-managed.md +25 -0
- package/dist/global-skills/neon-functions/SKILL.md +159 -84
- package/dist/global-skills/neon-functions/references/ai-sdk.md +4 -6
- package/dist/global-skills/neon-functions/references/function-triggers.md +249 -0
- package/dist/global-skills/neon-functions/references/mastra-studio.md +3 -3
- package/dist/global-skills/neon-functions/references/mcp.md +1 -1
- package/dist/global-skills/neon-functions/references/production-hardening.md +340 -0
- package/dist/global-skills/neon-functions/references/sse.md +8 -5
- package/dist/global-skills/neon-object-storage/SKILL.md +10 -11
- package/dist/global-skills/neon-postgres/SKILL.md +120 -17
- package/dist/global-skills/neon-postgres/references/full-text-search.md +99 -0
- package/dist/global-skills/neon-postgres/references/hybrid-search.md +90 -0
- package/dist/global-skills/neon-postgres/references/lakebase-search-drizzle.md +172 -0
- package/dist/global-skills/neon-postgres/references/vector-search.md +137 -0
- package/dist/global-skills/neon-postgres-branches/SKILL.md +3 -3
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +1 -1
- package/dist/global-skills/onboarding/SKILL.md +16 -14
- package/dist/global-skills/plan-my-idea/SKILL.md +1 -1
- package/dist/global-skills/publish-app/SKILL.md +1 -1
- package/dist/global-skills/publish-extension/SKILL.md +1 -1
- package/dist/global-skills/resend/SKILL.md +4 -2
- package/dist/global-skills/resend/references/broadcasts.md +6 -1
- package/dist/global-skills/resend/references/receiving.md +29 -10
- package/dist/global-skills/resend/references/sending/email-management.md +14 -4
- package/dist/global-skills/resend/references/topics.md +9 -6
- package/dist/global-skills/resend/references/usage.md +117 -0
- package/dist/global-skills/resend/references/webhooks.md +59 -2
- package/dist/global-skills/reset-password/SKILL.md +1 -1
- package/dist/global-skills/save-data/SKILL.md +1 -1
- package/dist/global-skills/setup-email/SKILL.md +1 -1
- package/dist/global-skills/setup-payments/SKILL.md +1 -1
- package/dist/global-skills/setup-sms/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-email-link/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-google/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-phone/SKILL.md +1 -1
- package/dist/global-skills/stripe-best-practices/SKILL.md +35 -29
- package/dist/global-skills/stripe-best-practices/references/billing.md +9 -2
- package/dist/global-skills/stripe-best-practices/references/payments.md +4 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +3 -1
- package/dist/global-skills/stripe-best-practices/references/tax.md +39 -20
- package/dist/global-skills/supabase/SKILL.md +6 -0
- package/dist/global-skills/track-errors/SKILL.md +1 -1
- package/dist/global-skills/update-kit/SKILL.md +1 -1
- package/dist/global-skills/use-railway/SKILL.md +42 -22
- package/dist/global-skills/use-railway/references/analyze-db.md +7 -6
- package/dist/global-skills/use-railway/references/cloud-agents.md +70 -0
- package/dist/global-skills/use-railway/references/configure.md +17 -2
- package/dist/global-skills/use-railway/references/databases.md +107 -0
- package/dist/global-skills/use-railway/references/deploy.md +5 -5
- package/dist/global-skills/use-railway/references/feature-flags.md +25 -13
- package/dist/global-skills/use-railway/references/iac.md +66 -77
- package/dist/global-skills/use-railway/references/operate.md +26 -3
- package/dist/global-skills/use-railway/references/request.md +31 -23
- package/dist/global-skills/use-railway/references/setup.md +16 -5
- package/dist/global-skills/use-railway/references/tracing.md +261 -0
- package/dist/global-skills/use-railway/references/usage.md +52 -0
- package/dist/global-skills/validate-my-idea/SKILL.md +54 -0
- package/dist/global-skills/{feedback → vybekiit-feedback}/SKILL.md +17 -13
- package/dist/global-skills/watch-my-app/SKILL.md +53 -0
- package/dist/global-skills/wire-auth/SKILL.md +1 -1
- package/dist/global-skills/wire-database/SKILL.md +1 -1
- package/dist/global-skills/wire-email/SKILL.md +1 -1
- package/dist/global-skills/wire-payments/SKILL.md +1 -1
- package/dist/global-skills/workers-best-practices/SKILL.md +36 -103
- package/dist/global-skills/workers-best-practices/references/configuration.md +139 -0
- package/dist/global-skills/workers-best-practices/references/platform-apis.md +51 -0
- package/dist/global-skills/workers-best-practices/references/{rules.md → runtime-patterns.md} +13 -137
- package/dist/global-skills/wrangler/SKILL.md +48 -901
- package/dist/global-skills/xcode-project-setup/scripts/xcode_spm_setup/Sources/main.swift +19 -15
- package/package.json +9 -8
- package/dist/global-skills/expo-native-ui/references/animations.md +0 -220
- package/dist/global-skills/firebase-firestore/references/enterprise/security_rules.md +0 -577
- package/dist/global-skills/workers-best-practices/references/review.md +0 -174
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
2
|
|
|
3
|
-
# TanStack Start
|
|
4
|
-
|
|
5
|
-
Copy page
|
|
6
|
-
|
|
7
|
-
# TanStack Start - Docs
|
|
3
|
+
# TanStack Start
|
|
8
4
|
|
|
9
5
|
This tutorial shows how to integrate PostHog with a [TanStack Start](https://tanstack.com/start) app for both client-side and server-side analytics.
|
|
10
6
|
|
|
@@ -14,8 +10,6 @@ Install the required packages:
|
|
|
14
10
|
|
|
15
11
|
Terminal
|
|
16
12
|
|
|
17
|
-
PostHog AI
|
|
18
|
-
|
|
19
13
|
```bash
|
|
20
14
|
npm install @posthog/react posthog-node
|
|
21
15
|
```
|
|
@@ -37,8 +31,6 @@ If your app calls your own backend, `tracing_headers` adds `X-POSTHOG-DISTINCT-I
|
|
|
37
31
|
|
|
38
32
|
JavaScript
|
|
39
33
|
|
|
40
|
-
PostHog AI
|
|
41
|
-
|
|
42
34
|
```javascript
|
|
43
35
|
posthog.init('<ph_project_token>', {
|
|
44
36
|
api_host: 'https://us.i.posthog.com',
|
|
@@ -55,14 +47,14 @@ Tracing headers help you attribute events across front and backend consistently.
|
|
|
55
47
|
|
|
56
48
|
Wrap your app with `PostHogProvider` in your root route with your project token, host, and other options.
|
|
57
49
|
|
|
58
|
-
PostHog AI
|
|
59
|
-
|
|
60
50
|
```
|
|
61
51
|
import CspAllowancesCallout from "../_snippets/csp-allowances-callout.mdx"
|
|
52
|
+
|
|
62
53
|
<CspAllowancesCallout />tsx file=src/routes/__root.tsx
|
|
63
54
|
// src/routes/__root.tsx
|
|
64
55
|
import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
|
|
65
56
|
import { PostHogProvider } from '@posthog/react'
|
|
57
|
+
|
|
66
58
|
export const Route = createRootRoute({
|
|
67
59
|
head: () => ({
|
|
68
60
|
meta: [
|
|
@@ -72,6 +64,7 @@ export const Route = createRootRoute({
|
|
|
72
64
|
}),
|
|
73
65
|
shellComponent: RootDocument,
|
|
74
66
|
})
|
|
67
|
+
|
|
75
68
|
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
76
69
|
return (
|
|
77
70
|
<html lang="en">
|
|
@@ -104,18 +97,19 @@ Use the `usePostHog` hook from `@posthog/react` in any component to capture cust
|
|
|
104
97
|
|
|
105
98
|
src/routes/checkout.tsx
|
|
106
99
|
|
|
107
|
-
PostHog AI
|
|
108
|
-
|
|
109
100
|
```jsx
|
|
110
101
|
import { usePostHog } from '@posthog/react'
|
|
102
|
+
|
|
111
103
|
function CheckoutButton({ orderId, total }: { orderId: string; total: number }) {
|
|
112
104
|
const posthog = usePostHog()
|
|
105
|
+
|
|
113
106
|
const handleClick = () => {
|
|
114
107
|
posthog.capture('checkout_started', {
|
|
115
108
|
order_id: orderId,
|
|
116
109
|
total: total,
|
|
117
110
|
})
|
|
118
111
|
}
|
|
112
|
+
|
|
119
113
|
return <button onClick={handleClick}>Checkout</button>
|
|
120
114
|
}
|
|
121
115
|
```
|
|
@@ -126,17 +120,19 @@ Call `posthog.identify()` when a user logs in to link their events to a user ID:
|
|
|
126
120
|
|
|
127
121
|
TSX
|
|
128
122
|
|
|
129
|
-
PostHog AI
|
|
130
|
-
|
|
131
123
|
```jsx
|
|
132
124
|
import { usePostHog } from '@posthog/react'
|
|
125
|
+
|
|
133
126
|
function LoginForm() {
|
|
134
127
|
const posthog = usePostHog()
|
|
128
|
+
|
|
135
129
|
const handleLogin = async (userId: string, email: string) => {
|
|
136
130
|
// ... your login logic
|
|
131
|
+
|
|
137
132
|
posthog.identify(userId, {
|
|
138
133
|
email: email,
|
|
139
134
|
})
|
|
135
|
+
|
|
140
136
|
posthog.capture('user_logged_in')
|
|
141
137
|
}
|
|
142
138
|
}
|
|
@@ -150,12 +146,12 @@ Create a server-side PostHog client using `posthog-node`. Use a singleton patter
|
|
|
150
146
|
|
|
151
147
|
src/utils/posthog-server.ts
|
|
152
148
|
|
|
153
|
-
PostHog AI
|
|
154
|
-
|
|
155
149
|
```typescript
|
|
156
150
|
// src/utils/posthog-server.ts
|
|
157
151
|
import { PostHog } from 'posthog-node'
|
|
152
|
+
|
|
158
153
|
let posthogClient: PostHog | null = null
|
|
154
|
+
|
|
159
155
|
export function getPostHogClient() {
|
|
160
156
|
if (!posthogClient) {
|
|
161
157
|
posthogClient = new PostHog(
|
|
@@ -177,19 +173,20 @@ Use the server client in TanStack Start API routes to capture events server-side
|
|
|
177
173
|
|
|
178
174
|
src/routes/api/checkout.ts
|
|
179
175
|
|
|
180
|
-
PostHog AI
|
|
181
|
-
|
|
182
176
|
```typescript
|
|
183
177
|
// src/routes/api/checkout.ts
|
|
184
178
|
import { createFileRoute } from '@tanstack/react-router'
|
|
185
179
|
import { json } from '@tanstack/react-start'
|
|
186
180
|
import { getPostHogClient } from '../../utils/posthog-server'
|
|
181
|
+
|
|
187
182
|
export const Route = createFileRoute('/api/checkout')({
|
|
188
183
|
server: {
|
|
189
184
|
handlers: {
|
|
190
185
|
POST: async ({ request }) => {
|
|
191
186
|
const body = await request.json()
|
|
187
|
+
|
|
192
188
|
const posthog = getPostHogClient()
|
|
189
|
+
|
|
193
190
|
posthog.capture({
|
|
194
191
|
distinctId: body.userId,
|
|
195
192
|
event: 'item_purchased',
|
|
@@ -199,6 +196,7 @@ export const Route = createFileRoute('/api/checkout')({
|
|
|
199
196
|
source: 'api',
|
|
200
197
|
},
|
|
201
198
|
})
|
|
199
|
+
|
|
202
200
|
return json({ success: true })
|
|
203
201
|
},
|
|
204
202
|
},
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
2
|
|
|
3
|
-
# iOS SDK usage
|
|
4
|
-
|
|
5
|
-
Copy page
|
|
6
|
-
|
|
7
|
-
# iOS SDK usage - Docs
|
|
3
|
+
# iOS SDK usage
|
|
8
4
|
|
|
9
5
|
## Capturing events
|
|
10
6
|
|
|
@@ -12,8 +8,6 @@ You can send custom events using `capture`:
|
|
|
12
8
|
|
|
13
9
|
Swift
|
|
14
10
|
|
|
15
|
-
PostHog AI
|
|
16
|
-
|
|
17
11
|
```swift
|
|
18
12
|
PostHogSDK.shared.capture("user_signed_up")
|
|
19
13
|
```
|
|
@@ -26,8 +20,6 @@ Optionally, you can include additional information with the event by including a
|
|
|
26
20
|
|
|
27
21
|
Swift
|
|
28
22
|
|
|
29
|
-
PostHog AI
|
|
30
|
-
|
|
31
23
|
```swift
|
|
32
24
|
PostHogSDK.shared.capture("user_signed_up", properties: ["login_type": "email"], userProperties: ["is_free_trial": true])
|
|
33
25
|
```
|
|
@@ -54,8 +46,6 @@ If you want to manually send a new screen capture event, use the `screen` functi
|
|
|
54
46
|
|
|
55
47
|
Swift
|
|
56
48
|
|
|
57
|
-
PostHog AI
|
|
58
|
-
|
|
59
49
|
```swift
|
|
60
50
|
PostHogSDK.shared.screen("Dashboard", properties: ["fromIcon": "bottom"])
|
|
61
51
|
```
|
|
@@ -70,8 +60,6 @@ To track a screen view in `SwiftUI`, apply the `postHogScreenView` modifier to y
|
|
|
70
60
|
|
|
71
61
|
HomeView.swift
|
|
72
62
|
|
|
73
|
-
PostHog AI
|
|
74
|
-
|
|
75
63
|
```swift
|
|
76
64
|
// This will trigger a screen view event with $screen_name: "HomeViewContent"
|
|
77
65
|
struct HomeView: View {
|
|
@@ -80,6 +68,7 @@ struct HomeView: View {
|
|
|
80
68
|
.postHogScreenView()
|
|
81
69
|
}
|
|
82
70
|
}
|
|
71
|
+
|
|
83
72
|
// This will trigger a screen view event with $screen_name: "My Home View" and an additional event property from_button: "start"
|
|
84
73
|
struct HomeView: View {
|
|
85
74
|
var body: some View {
|
|
@@ -103,8 +92,6 @@ To assign a custom label to a UIView, use the `postHogLabel` property:
|
|
|
103
92
|
|
|
104
93
|
Swift
|
|
105
94
|
|
|
106
|
-
PostHog AI
|
|
107
|
-
|
|
108
95
|
```swift
|
|
109
96
|
let view = UIView()
|
|
110
97
|
view.postHogLabel = "usernameTextField"
|
|
@@ -118,8 +105,6 @@ In SwiftUI, use the `.postHogLabel(_:)` modifier instead:
|
|
|
118
105
|
|
|
119
106
|
Swift
|
|
120
107
|
|
|
121
|
-
PostHog AI
|
|
122
|
-
|
|
123
108
|
```swift
|
|
124
109
|
var body: some View {
|
|
125
110
|
...
|
|
@@ -136,8 +121,6 @@ The generated analytics element in the examples above will have the following fo
|
|
|
136
121
|
|
|
137
122
|
Swift
|
|
138
123
|
|
|
139
|
-
PostHog AI
|
|
140
|
-
|
|
141
124
|
```swift
|
|
142
125
|
<UITextField id="usernameTextField">text value</UITextField>
|
|
143
126
|
```
|
|
@@ -163,8 +146,6 @@ Interaction autocapture is **not enabled by default**. You can enable it by sett
|
|
|
163
146
|
|
|
164
147
|
Swift
|
|
165
148
|
|
|
166
|
-
PostHog AI
|
|
167
|
-
|
|
168
149
|
```swift
|
|
169
150
|
let config = PostHogConfig(projectToken: "<ph_project_token>", host: "https://us.i.posthog.com")
|
|
170
151
|
config.captureElementInteractions = true // Disabled by default
|
|
@@ -183,8 +164,6 @@ It is enabled by default (`rageClickConfig.enabled = true`).
|
|
|
183
164
|
|
|
184
165
|
Swift
|
|
185
166
|
|
|
186
|
-
PostHog AI
|
|
187
|
-
|
|
188
167
|
```swift
|
|
189
168
|
let config = PostHogConfig(projectToken: "<ph_project_token>", host: "https://us.i.posthog.com")
|
|
190
169
|
config.rageClickConfig.enabled = true // Enabled by default
|
|
@@ -217,8 +196,6 @@ An `identify` call has the following arguments:
|
|
|
217
196
|
|
|
218
197
|
Swift
|
|
219
198
|
|
|
220
|
-
PostHog AI
|
|
221
|
-
|
|
222
199
|
```swift
|
|
223
200
|
PostHogSDK.shared.identify("user_id_from_your_database",
|
|
224
201
|
userProperties: ["name": "Peter Griffin", "email": "peter@familyguy.com"],
|
|
@@ -243,13 +220,11 @@ In this case, you can use `alias` to assign another distinct ID to the same user
|
|
|
243
220
|
|
|
244
221
|
Swift
|
|
245
222
|
|
|
246
|
-
PostHog AI
|
|
247
|
-
|
|
248
223
|
```swift
|
|
249
224
|
PostHogSDK.shared.alias("alias_id")
|
|
250
225
|
```
|
|
251
226
|
|
|
252
|
-
We strongly recommend reading our docs on [alias](/docs/
|
|
227
|
+
We strongly recommend reading our docs on [alias](/docs/product-analytics/identify.md#alias-assigning-multiple-distinct-ids-to-the-same-user) to best understand how to correctly use this method.
|
|
253
228
|
|
|
254
229
|
## Anonymous vs identified events
|
|
255
230
|
|
|
@@ -289,8 +264,6 @@ For example:
|
|
|
289
264
|
|
|
290
265
|
iOS
|
|
291
266
|
|
|
292
|
-
PostHog AI
|
|
293
|
-
|
|
294
267
|
```swift
|
|
295
268
|
let config = PostHogConfig(
|
|
296
269
|
projectToken: POSTHOG_PROJECT_TOKEN,
|
|
@@ -314,14 +287,12 @@ Alternatively, you can set `personProfiles` to `.always` to capture identified e
|
|
|
314
287
|
|
|
315
288
|
## Setting person properties
|
|
316
289
|
|
|
317
|
-
To set [properties](/docs/
|
|
290
|
+
To set [properties](/docs/product-analytics/person-properties.md) on your users via an event, you can leverage the event properties `userProperties` and `userPropertiesSetOnce`.
|
|
318
291
|
|
|
319
292
|
When capturing an event, you can pass a property called `$set` as an event property, and specify its value to be an object with properties to be set on the user that will be associated with the user who triggered the event.
|
|
320
293
|
|
|
321
294
|
Swift
|
|
322
295
|
|
|
323
|
-
PostHog AI
|
|
324
|
-
|
|
325
296
|
```swift
|
|
326
297
|
PostHogSDK.shared.capture("signed_up", properties: ["plan": "Pro++"], userProperties: ["user_property_name": "your_value"])
|
|
327
298
|
```
|
|
@@ -330,8 +301,6 @@ PostHogSDK.shared.capture("signed_up", properties: ["plan": "Pro++"], userProper
|
|
|
330
301
|
|
|
331
302
|
Swift
|
|
332
303
|
|
|
333
|
-
PostHog AI
|
|
334
|
-
|
|
335
304
|
```swift
|
|
336
305
|
PostHogSDK.shared.capture("signed_up", properties: ["plan": "Pro++"], userPropertiesSetOnce: ["user_property_name": "your_value"])
|
|
337
306
|
```
|
|
@@ -340,10 +309,9 @@ Use `setPersonProperties` when you want to update the current person's profile w
|
|
|
340
309
|
|
|
341
310
|
Swift
|
|
342
311
|
|
|
343
|
-
PostHog AI
|
|
344
|
-
|
|
345
312
|
```swift
|
|
346
313
|
PostHogSDK.shared.setPersonProperties(userPropertiesToSet: ["plan": "Pro++"])
|
|
314
|
+
|
|
347
315
|
PostHogSDK.shared.setPersonProperties(
|
|
348
316
|
userPropertiesToSet: ["plan": "Pro++"],
|
|
349
317
|
userPropertiesToSetOnce: ["first_seen_source": "ios"]
|
|
@@ -360,8 +328,6 @@ For example, take a look at the following call:
|
|
|
360
328
|
|
|
361
329
|
Swift
|
|
362
330
|
|
|
363
|
-
PostHog AI
|
|
364
|
-
|
|
365
331
|
```swift
|
|
366
332
|
PostHogSDK.shared.register(["team_id": 22])
|
|
367
333
|
```
|
|
@@ -376,8 +342,6 @@ Super properties persist across sessions so you have to explicitly remove them i
|
|
|
376
342
|
|
|
377
343
|
Swift
|
|
378
344
|
|
|
379
|
-
PostHog AI
|
|
380
|
-
|
|
381
345
|
```swift
|
|
382
346
|
PostHogSDK.shared.unregister("team_id")
|
|
383
347
|
```
|
|
@@ -408,11 +372,10 @@ PostHog's [feature flags](/docs/feature-flags.md) enable you to safely deploy an
|
|
|
408
372
|
|
|
409
373
|
Swift
|
|
410
374
|
|
|
411
|
-
PostHog AI
|
|
412
|
-
|
|
413
375
|
```swift
|
|
414
376
|
if let result = PostHogSDK.shared.getFeatureFlagResult("flag-key"), result.enabled {
|
|
415
377
|
// Do something differently for this user
|
|
378
|
+
|
|
416
379
|
// Optional: fetch the payload from the same evaluation result
|
|
417
380
|
let matchedFlagPayload = result.payload
|
|
418
381
|
}
|
|
@@ -422,11 +385,10 @@ if let result = PostHogSDK.shared.getFeatureFlagResult("flag-key"), result.enabl
|
|
|
422
385
|
|
|
423
386
|
Swift
|
|
424
387
|
|
|
425
|
-
PostHog AI
|
|
426
|
-
|
|
427
388
|
```swift
|
|
428
389
|
if let result = PostHogSDK.shared.getFeatureFlagResult("flag-key"), result.variant == "variant-key" { // replace "variant-key" with the key of your variant
|
|
429
390
|
// Do something differently for this user
|
|
391
|
+
|
|
430
392
|
// Optional: fetch the payload from the same evaluation result
|
|
431
393
|
let matchedFlagPayload = result.payload
|
|
432
394
|
}
|
|
@@ -438,12 +400,11 @@ If your payload is a JSON object, you can decode it into a `Decodable` type:
|
|
|
438
400
|
|
|
439
401
|
Swift
|
|
440
402
|
|
|
441
|
-
PostHog AI
|
|
442
|
-
|
|
443
403
|
```swift
|
|
444
404
|
struct FlagPayload: Decodable {
|
|
445
405
|
let title: String
|
|
446
406
|
}
|
|
407
|
+
|
|
447
408
|
if let result = PostHogSDK.shared.getFeatureFlagResult("flag-key"),
|
|
448
409
|
let payload = result.payloadAs(FlagPayload.self) {
|
|
449
410
|
// Use payload.title
|
|
@@ -456,8 +417,6 @@ You can inspect all currently loaded feature flags with `getAllFeatureFlags()`.
|
|
|
456
417
|
|
|
457
418
|
Swift
|
|
458
419
|
|
|
459
|
-
PostHog AI
|
|
460
|
-
|
|
461
420
|
```swift
|
|
462
421
|
for flag in PostHogSDK.shared.getAllFeatureFlags() ?? [] {
|
|
463
422
|
print(flag.key, flag.enabled, flag.variant as Any, flag.payload as Any)
|
|
@@ -470,8 +429,6 @@ Feature flag values are cached. If something has changed with your user and you'
|
|
|
470
429
|
|
|
471
430
|
Swift
|
|
472
431
|
|
|
473
|
-
PostHog AI
|
|
474
|
-
|
|
475
432
|
```swift
|
|
476
433
|
PostHogSDK.shared.reloadFeatureFlags()
|
|
477
434
|
```
|
|
@@ -486,8 +443,6 @@ To handle this, you can use the `didReceiveFeatureFlags` notification to wait fo
|
|
|
486
443
|
|
|
487
444
|
Swift
|
|
488
445
|
|
|
489
|
-
PostHog AI
|
|
490
|
-
|
|
491
446
|
```swift
|
|
492
447
|
class AppDelegate: NSObject, UIApplicationDelegate {
|
|
493
448
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
|
@@ -498,13 +453,18 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
|
|
498
453
|
name: PostHogSDK.didReceiveFeatureFlags,
|
|
499
454
|
object: nil
|
|
500
455
|
)
|
|
456
|
+
|
|
501
457
|
let POSTHOG_PROJECT_TOKEN = "<ph_project_token>"
|
|
502
458
|
// usually 'https://us.i.posthog.com' or 'https://eu.i.posthog.com'
|
|
503
459
|
let POSTHOG_HOST = "https://us.i.posthog.com"
|
|
460
|
+
|
|
504
461
|
let config = PostHogConfig(projectToken: POSTHOG_PROJECT_TOKEN, host: POSTHOG_HOST)
|
|
462
|
+
|
|
505
463
|
PostHogSDK.shared.setup(config)
|
|
464
|
+
|
|
506
465
|
return true
|
|
507
466
|
}
|
|
467
|
+
|
|
508
468
|
// The "receiveFeatureFlags" method will be called when the SDK receives the feature flags from the server.
|
|
509
469
|
@objc func receiveFeatureFlags() {
|
|
510
470
|
print("receiveFeatureFlags called")
|
|
@@ -516,8 +476,6 @@ Alternatively, you can use the completion block of the `reloadFeatureFlags(_:)`
|
|
|
516
476
|
|
|
517
477
|
Swift
|
|
518
478
|
|
|
519
|
-
PostHog AI
|
|
520
|
-
|
|
521
479
|
```swift
|
|
522
480
|
// Reload feature flags and check if a specific feature is enabled
|
|
523
481
|
PostHogSDK.shared.reloadFeatureFlags {
|
|
@@ -533,8 +491,6 @@ To track when someone sees or interacts with a feature, use `captureFeatureView`
|
|
|
533
491
|
|
|
534
492
|
Swift
|
|
535
493
|
|
|
536
|
-
PostHog AI
|
|
537
|
-
|
|
538
494
|
```swift
|
|
539
495
|
PostHogSDK.shared.captureFeatureView(flag: "flag-key", flagVariant: "variant-key")
|
|
540
496
|
PostHogSDK.shared.captureFeatureInteraction(flag: "flag-key", flagVariant: "variant-key")
|
|
@@ -550,8 +506,6 @@ Set `config.bootstrap` before calling `setup()` to seed identity and flag values
|
|
|
550
506
|
|
|
551
507
|
Swift
|
|
552
508
|
|
|
553
|
-
PostHog AI
|
|
554
|
-
|
|
555
509
|
```swift
|
|
556
510
|
let config = PostHogConfig(projectToken: "<ph_project_token>", host: "https://us.i.posthog.com")
|
|
557
511
|
config.bootstrap = PostHogBootstrapConfig(
|
|
@@ -609,8 +563,6 @@ You can enable debug mode by setting the `debug` option to `true` in the `PostHo
|
|
|
609
563
|
|
|
610
564
|
Swift
|
|
611
565
|
|
|
612
|
-
PostHog AI
|
|
613
|
-
|
|
614
566
|
```swift
|
|
615
567
|
let config = PostHogConfig(projectToken: "<ph_project_token>", host: "https://us.i.posthog.com")
|
|
616
568
|
config.debug = true
|
|
@@ -623,11 +575,10 @@ You can also toggle debug by calling the `PostHogSDK.shared.debug()` method in y
|
|
|
623
575
|
|
|
624
576
|
Swift
|
|
625
577
|
|
|
626
|
-
PostHog AI
|
|
627
|
-
|
|
628
578
|
```swift
|
|
629
579
|
// Enable debug mode
|
|
630
580
|
PostHogSDK.shared.debug(true)
|
|
581
|
+
|
|
631
582
|
// Disable debug mode
|
|
632
583
|
PostHogSDK.shared.debug(false)
|
|
633
584
|
```
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
2
|
|
|
3
|
-
# Vue.js
|
|
4
|
-
|
|
5
|
-
Copy page
|
|
6
|
-
|
|
7
|
-
# Vue.js - Docs
|
|
3
|
+
# Vue.js
|
|
8
4
|
|
|
9
5
|
PostHog makes it easy to get data about usage of your [Vue.js](https://vuejs.org/) app. Integrating PostHog into your app enables analytics about user behavior, custom events capture, session replays, feature flags, and more.
|
|
10
6
|
|
|
@@ -23,8 +19,6 @@ To follow this guide along, you need:
|
|
|
23
19
|
|
|
24
20
|
Start by installing `posthog-js` using your package manager:
|
|
25
21
|
|
|
26
|
-
PostHog AI
|
|
27
|
-
|
|
28
22
|
### npm
|
|
29
23
|
|
|
30
24
|
```bash
|
|
@@ -51,8 +45,6 @@ bun add posthog-js
|
|
|
51
45
|
|
|
52
46
|
> **If your site sets a Content-Security-Policy**, it needs to allow PostHog. This applies to the snippet and to package installs alike: the SDK lazy-loads extra bundles (session replay, surveys) from PostHog's CDN, and sends events to the ingestion host. PostHog serves from subdomains of `posthog.com` that change over time, so allow the wildcard:
|
|
53
47
|
>
|
|
54
|
-
> PostHog AI
|
|
55
|
-
>
|
|
56
48
|
> ```
|
|
57
49
|
> script-src 'self' https://*.posthog.com;
|
|
58
50
|
> connect-src 'self' https://*.posthog.com;
|
|
@@ -71,25 +63,29 @@ PostHog initializes as a singleton, so you can initialize it in your `main.ts` f
|
|
|
71
63
|
|
|
72
64
|
src/main.ts
|
|
73
65
|
|
|
74
|
-
PostHog AI
|
|
75
|
-
|
|
76
66
|
```typescript
|
|
77
67
|
// src/main.ts
|
|
78
68
|
import { createApp } from 'vue'
|
|
79
69
|
import { createPinia } from 'pinia'
|
|
70
|
+
|
|
80
71
|
import App from './App.vue'
|
|
81
72
|
import router from './router'
|
|
82
73
|
import posthog from "posthog-js";
|
|
74
|
+
|
|
83
75
|
const app = createApp(App);
|
|
76
|
+
|
|
84
77
|
posthog.init(import.meta.env.VITE_POSTHOG_PROJECT_TOKEN || '<ph_project_token>', {
|
|
85
78
|
api_host: import.meta.env.VITE_POSTHOG_HOST || 'https://us.i.posthog.com',
|
|
86
79
|
defaults: '2026-05-30',
|
|
87
80
|
});
|
|
81
|
+
|
|
88
82
|
app.use(createPinia())
|
|
89
83
|
app.use(router)
|
|
84
|
+
|
|
90
85
|
app.config.errorHandler = (err, instance, info) => {
|
|
91
86
|
posthog.captureException(err)
|
|
92
87
|
}
|
|
88
|
+
|
|
93
89
|
app.mount('#app')
|
|
94
90
|
```
|
|
95
91
|
|
|
@@ -97,12 +93,11 @@ Then, you can access PostHog throughout your app just by importing it from `post
|
|
|
97
93
|
|
|
98
94
|
TypeScript
|
|
99
95
|
|
|
100
|
-
PostHog AI
|
|
101
|
-
|
|
102
96
|
```typescript
|
|
103
97
|
// src/App.vue
|
|
104
98
|
<script setup>
|
|
105
99
|
import posthog from 'posthog-js'
|
|
100
|
+
|
|
106
101
|
const handleClick = () => {
|
|
107
102
|
posthog.capture('button_clicked')
|
|
108
103
|
}
|
|
@@ -117,17 +112,17 @@ Start by creating a `plugins` folder and adding a `posthog.js` file to that fold
|
|
|
117
112
|
|
|
118
113
|
JavaScript
|
|
119
114
|
|
|
120
|
-
PostHog AI
|
|
121
|
-
|
|
122
115
|
```javascript
|
|
123
116
|
// src/plugins/posthog.js
|
|
124
117
|
import posthog from 'posthog-js'
|
|
118
|
+
|
|
125
119
|
export default {
|
|
126
120
|
install(Vue) {
|
|
127
121
|
posthog.init('<ph_project_token>', {
|
|
128
122
|
api_host: 'https://us.i.posthog.com',
|
|
129
123
|
defaults: '2026-05-30'
|
|
130
124
|
})
|
|
125
|
+
|
|
131
126
|
Vue.prototype.$posthog = posthog
|
|
132
127
|
}
|
|
133
128
|
}
|
|
@@ -137,15 +132,15 @@ Next, in `main.js`, import and use the plugin.
|
|
|
137
132
|
|
|
138
133
|
JavaScript
|
|
139
134
|
|
|
140
|
-
PostHog AI
|
|
141
|
-
|
|
142
135
|
```javascript
|
|
143
136
|
// src/main.js
|
|
144
137
|
import Vue from 'vue'
|
|
145
138
|
import App from './App.vue'
|
|
146
139
|
import PosthogPlugin from './plugins/posthog'
|
|
140
|
+
|
|
147
141
|
Vue.config.productionTip = false
|
|
148
142
|
Vue.use(PosthogPlugin)
|
|
143
|
+
|
|
149
144
|
new Vue({
|
|
150
145
|
render: h => h(App),
|
|
151
146
|
}).$mount('#app')
|
|
@@ -167,8 +162,6 @@ If your app calls your own backend, `tracing_headers` adds `X-POSTHOG-DISTINCT-I
|
|
|
167
162
|
|
|
168
163
|
JavaScript
|
|
169
164
|
|
|
170
|
-
PostHog AI
|
|
171
|
-
|
|
172
165
|
```javascript
|
|
173
166
|
posthog.init('<ph_project_token>', {
|
|
174
167
|
api_host: 'https://us.i.posthog.com',
|
|
@@ -191,22 +184,24 @@ To capture custom events, evaluate feature flags, and use any of the other PostH
|
|
|
191
184
|
|
|
192
185
|
JavaScript
|
|
193
186
|
|
|
194
|
-
PostHog AI
|
|
195
|
-
|
|
196
187
|
```javascript
|
|
197
188
|
// src/App.vue
|
|
198
189
|
<script setup>
|
|
199
190
|
import { RouterView } from 'vue-router'
|
|
200
191
|
import { usePostHog } from './composables/usePostHog'
|
|
192
|
+
|
|
201
193
|
const { posthog } = usePostHog()
|
|
194
|
+
|
|
202
195
|
const handleClick = () => {
|
|
203
196
|
posthog.capture('button_clicked', { location: 'homepage' })
|
|
204
197
|
}
|
|
205
198
|
</script>
|
|
199
|
+
|
|
206
200
|
<template>
|
|
207
201
|
<div>
|
|
208
202
|
<button @click="handleClick">Click me!</button>
|
|
209
203
|
</div>
|
|
204
|
+
|
|
210
205
|
<RouterView />
|
|
211
206
|
</template>
|
|
212
207
|
```
|
|
@@ -217,20 +212,21 @@ When using feature flags on pages that users navigate to directly, the flags may
|
|
|
217
212
|
|
|
218
213
|
JavaScript
|
|
219
214
|
|
|
220
|
-
PostHog AI
|
|
221
|
-
|
|
222
215
|
```javascript
|
|
223
216
|
// src/composables/usePostHogFeatureFlag.ts
|
|
224
217
|
import { ref, type Ref } from 'vue'
|
|
225
218
|
import { usePostHog } from './usePostHog'
|
|
219
|
+
|
|
226
220
|
export function usePostHogFeatureFlag(
|
|
227
221
|
feature: string,
|
|
228
222
|
): Ref<string | boolean | undefined> {
|
|
229
223
|
const { posthog } = usePostHog()
|
|
230
224
|
const flag = ref(posthog.getFeatureFlag(feature))
|
|
225
|
+
|
|
231
226
|
posthog.onFeatureFlags(() => {
|
|
232
227
|
flag.value = posthog.getFeatureFlag(feature)
|
|
233
228
|
})
|
|
229
|
+
|
|
234
230
|
return flag
|
|
235
231
|
}
|
|
236
232
|
```
|
|
@@ -239,25 +235,27 @@ Then use it in your components:
|
|
|
239
235
|
|
|
240
236
|
JavaScript
|
|
241
237
|
|
|
242
|
-
PostHog AI
|
|
243
|
-
|
|
244
238
|
```javascript
|
|
245
239
|
// src/App.vue
|
|
246
240
|
<script setup>
|
|
247
241
|
import { RouterView } from 'vue-router'
|
|
248
242
|
import { usePostHog } from './composables/usePostHog'
|
|
249
243
|
import { usePostHogFeatureFlag } from './composables/usePostHogFeatureFlag'
|
|
244
|
+
|
|
250
245
|
const { posthog } = usePostHog()
|
|
251
246
|
const isFeatureEnabled = usePostHogFeatureFlag('test-flag')
|
|
247
|
+
|
|
252
248
|
const handleClick = () => {
|
|
253
249
|
posthog.capture('button_clicked', { location: 'homepage' })
|
|
254
250
|
}
|
|
255
251
|
</script>
|
|
252
|
+
|
|
256
253
|
<template>
|
|
257
254
|
<div>
|
|
258
255
|
<button @click="handleClick">Click me!</button>
|
|
259
256
|
<p>Is feature flag enabled? {{ isFeatureEnabled ? 'Yes' : 'No' }}</p>
|
|
260
257
|
</div>
|
|
258
|
+
|
|
261
259
|
<RouterView />
|
|
262
260
|
</template>
|
|
263
261
|
```
|
|
@@ -270,8 +268,6 @@ To capture custom events, evaluate feature flags, and use any of the other PostH
|
|
|
270
268
|
|
|
271
269
|
JavaScript
|
|
272
270
|
|
|
273
|
-
PostHog AI
|
|
274
|
-
|
|
275
271
|
```javascript
|
|
276
272
|
// src/components/AboutPage.vue
|
|
277
273
|
<template>
|
|
@@ -282,6 +278,7 @@ PostHog AI
|
|
|
282
278
|
<p>Feature enabled? {{ isFeatureEnabled ? 'Yes' : 'No' }}</p>
|
|
283
279
|
</div>
|
|
284
280
|
</template>
|
|
281
|
+
|
|
285
282
|
<script>
|
|
286
283
|
export default {
|
|
287
284
|
name: 'AboutPage',
|
|
@@ -324,7 +321,11 @@ For certain features like [heatmaps](/docs/toolbar/heatmaps.md), your Web Applic
|
|
|
324
321
|
|
|
325
322
|
**US**: `44.205.89.55`, `52.4.194.122`, `44.208.188.173`
|
|
326
323
|
|
|
327
|
-
These are public, stable IPs used by PostHog services
|
|
324
|
+
These are public, stable IPs used by PostHog services.
|
|
325
|
+
|
|
326
|
+
PostHog captures heatmap screenshots using [Browserless](https://www.browserless.io), which has its own IP addresses. Browserless [publishes the current list here](https://docs.browserless.io/baas/troubleshooting/whitelisting-ips).
|
|
327
|
+
|
|
328
|
+
An allowlist does not help when your app has a private address. For apps on an internal network, see [internal and intranet applications](/docs/session-replay/troubleshooting.md#internal-and-intranet-applications).
|
|
328
329
|
|
|
329
330
|
## Next steps
|
|
330
331
|
|