vybekiit 0.7.3 → 0.7.7
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 +16607 -7527
- package/dist/global-skills/aws-cdk/SKILL.md +2 -1
- package/dist/global-skills/aws-cloudformation/SKILL.md +2 -1
- package/dist/global-skills/aws-serverless/SKILL.md +45 -44
- package/dist/global-skills/aws-serverless/assets/powertools-handler.py +2 -1
- package/dist/global-skills/aws-serverless/references/api-gateway.md +50 -470
- package/dist/global-skills/aws-serverless/references/architecture.md +47 -186
- package/dist/global-skills/aws-serverless/references/concurrency.md +44 -158
- package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
- package/dist/global-skills/aws-serverless/references/event-sources.md +72 -391
- package/dist/global-skills/aws-serverless/references/lambda.md +69 -428
- package/dist/global-skills/aws-serverless/references/orchestration.md +65 -384
- package/dist/global-skills/aws-serverless/references/production.md +78 -415
- package/dist/global-skills/aws-serverless/references/troubleshooting.md +92 -619
- package/dist/global-skills/claimable-postgres/SKILL.md +60 -49
- package/dist/global-skills/design-my-data/SKILL.md +2 -0
- package/dist/global-skills/eas-app-stores/SKILL.md +8 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +2 -0
- package/dist/global-skills/eas-hosting/SKILL.md +8 -0
- package/dist/global-skills/eas-observe/SKILL.md +30 -8
- package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-observe/references/metrics.md +54 -3
- package/dist/global-skills/eas-observe/references/queries.md +78 -17
- package/dist/global-skills/eas-observe/references/setup.md +164 -5
- package/dist/global-skills/eas-observe/references/third-party.md +136 -0
- package/dist/global-skills/eas-simulator/SKILL.md +63 -11
- package/dist/global-skills/eas-simulator/references/controllers.md +21 -2
- package/dist/global-skills/eas-simulator/references/run-your-app.md +16 -11
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -5
- package/dist/global-skills/eas-update-insights/SKILL.md +8 -0
- package/dist/global-skills/eas-workflows/SKILL.md +15 -10
- package/dist/global-skills/eas-workflows/scripts/package.json +2 -7
- package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +30 -0
- package/dist/global-skills/email-best-practices/README.md +63 -0
- package/dist/global-skills/email-best-practices/references/accessibility.md +189 -0
- package/dist/global-skills/email-best-practices/references/compliance.md +125 -0
- package/dist/global-skills/email-best-practices/references/deliverability.md +121 -0
- package/dist/global-skills/email-best-practices/references/email-capture.md +129 -0
- package/dist/global-skills/email-best-practices/references/email-types.md +173 -0
- package/dist/global-skills/email-best-practices/references/list-management.md +157 -0
- package/dist/global-skills/email-best-practices/references/marketing-emails.md +115 -0
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +155 -0
- package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +418 -0
- package/dist/global-skills/email-best-practices/references/transactional-emails.md +92 -0
- package/dist/global-skills/email-best-practices/references/webhooks-events.md +167 -0
- package/dist/global-skills/email-best-practices/tests/README.md +35 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +46 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +48 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +36 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +52 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +51 -0
- package/dist/global-skills/expo-animation/LICENSE +21 -0
- package/dist/global-skills/expo-animation/RECIPES.md +385 -0
- package/dist/global-skills/expo-animation/SKILL.md +267 -0
- package/dist/global-skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-app-clip/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +53 -4
- package/dist/global-skills/expo-data-fetching/SKILL.md +8 -0
- package/dist/global-skills/expo-design-system/SKILL.md +356 -0
- package/dist/global-skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-design-system/references/audit.md +185 -0
- package/dist/global-skills/expo-dev-client/SKILL.md +8 -0
- package/dist/global-skills/expo-dom/SKILL.md +8 -0
- package/dist/global-skills/expo-examples/SKILL.md +8 -0
- package/dist/global-skills/expo-migrate-module/SKILL.md +113 -0
- package/dist/global-skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +73 -0
- package/dist/global-skills/expo-migrate-module/references/example.md +212 -0
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +306 -0
- package/dist/global-skills/expo-module/SKILL.md +11 -1
- package/dist/global-skills/expo-native-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-project-structure/SKILL.md +114 -0
- package/dist/global-skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-router/SKILL.md +8 -0
- package/dist/global-skills/expo-skill-feedback/SKILL.md +66 -33
- package/dist/global-skills/expo-skill-feedback/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-tailwind-setup/SKILL.md +8 -0
- package/dist/global-skills/expo-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-upgrade/SKILL.md +15 -1
- package/dist/global-skills/expo-web-to-native/SKILL.md +8 -0
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +129 -0
- package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md +161 -0
- package/dist/global-skills/extension-to-functions-codebase/references/destructuring-shim.md +122 -0
- package/dist/global-skills/extension-to-functions-codebase/references/signature-mapping.md +84 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +61 -19
- package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +6 -3
- package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +4 -2
- package/dist/global-skills/firebase-basics/SKILL.md +5 -5
- package/dist/global-skills/firebase-crashlytics/SKILL.md +2 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -0
- package/dist/global-skills/firebase-firestore/SKILL.md +3 -6
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +4 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +4 -1
- package/dist/global-skills/harden/SKILL.md +2 -1
- package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
- package/dist/global-skills/instrument-feature-flags/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/api.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/django.md +38 -5
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/flask.md +17 -5
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +7 -5
- package/dist/global-skills/instrument-feature-flags/references/go.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ios.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/java.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +74 -8
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/php.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/python.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/rust.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/usage.md +41 -4
- package/dist/global-skills/instrument-feature-flags/references/web.md +7 -5
- package/dist/global-skills/instrument-product-analytics/SKILL.md +2 -1
- package/dist/global-skills/instrument-product-analytics/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +12 -14
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +25 -21
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-django.md +75 -55
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-fastapi.md +3 -6
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-flask.md +26 -16
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-3-6.md +8 -5
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-4.md +4 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-react-react-router-7-framework.md +3 -3
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +8 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-tanstack-start.md +20 -8
- package/dist/global-skills/instrument-product-analytics/references/android.md +46 -4
- package/dist/global-skills/instrument-product-analytics/references/angular.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/astro.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +7 -4
- package/dist/global-skills/instrument-product-analytics/references/django.md +38 -5
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/flask.md +17 -5
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +49 -4
- package/dist/global-skills/instrument-product-analytics/references/go.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +38 -7
- package/dist/global-skills/instrument-product-analytics/references/ios.md +14 -4
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +74 -8
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +39 -7
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +40 -4
- package/dist/global-skills/instrument-product-analytics/references/php.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +21 -17
- package/dist/global-skills/instrument-product-analytics/references/python.md +15 -5
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +41 -7
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +42 -6
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +31 -7
- package/dist/global-skills/instrument-product-analytics/references/usage.md +41 -4
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +42 -6
- package/dist/global-skills/manifest.json +6 -1
- package/dist/global-skills/neon/SKILL.md +235 -121
- package/dist/global-skills/neon-ai-gateway/SKILL.md +95 -16
- package/dist/global-skills/neon-functions/SKILL.md +242 -152
- package/dist/global-skills/neon-functions/references/ai-sdk.md +9 -3
- package/dist/global-skills/neon-functions/references/mastra-studio.md +1 -1
- package/dist/global-skills/neon-functions/references/mcp.md +13 -4
- package/dist/global-skills/neon-functions/references/sentry.md +165 -52
- package/dist/global-skills/neon-functions/references/sse.md +23 -6
- package/dist/global-skills/neon-object-storage/SKILL.md +40 -16
- package/dist/global-skills/neon-postgres/SKILL.md +63 -262
- package/dist/global-skills/neon-postgres-branches/SKILL.md +61 -50
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +22 -3
- package/dist/global-skills/resend/SKILL.md +6 -6
- package/dist/global-skills/resend/references/automations.md +2 -2
- package/dist/global-skills/resend/references/broadcasts.md +11 -3
- package/dist/global-skills/resend/references/domains.md +25 -3
- package/dist/global-skills/resend/references/installation.md +7 -7
- package/dist/global-skills/setup-payments/SKILL.md +4 -5
- package/dist/global-skills/stripe-best-practices/SKILL.md +32 -7
- package/dist/global-skills/stripe-best-practices/references/billing.md +11 -1
- package/dist/global-skills/stripe-best-practices/references/payments.md +23 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +21 -11
- package/dist/global-skills/stripe-best-practices/references/tax.md +116 -11
- package/dist/global-skills/supabase/CHANGELOG.md +25 -0
- package/dist/global-skills/supabase/SKILL.md +5 -1
- package/dist/global-skills/supabase-postgres-best-practices/CHANGELOG.md +30 -0
- package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -1
- package/dist/global-skills/use-kit-mcp/SKILL.md +5 -5
- package/dist/global-skills/use-railway/SKILL.md +4 -4
- package/dist/global-skills/use-railway/references/iac.md +206 -57
- package/dist/global-skills/use-railway/scripts/railway-api.sh +7 -2
- package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
- package/package.json +12 -9
- package/LICENSE.md +0 -47
- package/dist/global-skills/eas-workflows/scripts/validate.js +0 -84
- package/dist/global-skills/expo-skill-feedback/scripts/skill-feedback.cjs +0 -118
- package/dist/global-skills/neon-functions/references/hono-websockets.md +0 -145
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Angular - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Angular - Docs
|
|
2
8
|
|
|
3
9
|
PostHog makes it easy to get data about traffic and usage of your [Angular](https://angular.dev/) app. Integrating PostHog into your site enables analytics about user behavior, custom events capture, session recordings, feature flags, and more.
|
|
@@ -34,6 +40,18 @@ pnpm add posthog-js
|
|
|
34
40
|
bun add posthog-js
|
|
35
41
|
```
|
|
36
42
|
|
|
43
|
+
> **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:
|
|
44
|
+
>
|
|
45
|
+
> PostHog AI
|
|
46
|
+
>
|
|
47
|
+
> ```
|
|
48
|
+
> script-src 'self' https://*.posthog.com;
|
|
49
|
+
> connect-src 'self' https://*.posthog.com;
|
|
50
|
+
> worker-src 'self' blob: data:;
|
|
51
|
+
> ```
|
|
52
|
+
>
|
|
53
|
+
> `script-src` covers the snippet and the lazy-loaded bundles, `connect-src` covers event ingestion and feature flags, and `worker-src` covers session replay. The [toolbar needs a few more](/docs/advanced/content-security-policy.md), or use a [reverse proxy](/docs/advanced/proxy.md) so everything is first-party. Failing to do so causes silent failures where `capture` and `identify` calls never send, so the integration looks complete while zero events arrive. Remember `connect-src` falls back to `default-src`, so `default-src 'self'` blocks event delivery even when the script itself is bundled.
|
|
54
|
+
|
|
37
55
|
### Initialize the PostHog client
|
|
38
56
|
|
|
39
57
|
Generate environment files for your project with `ng g environments`. Configure the following environment variables:
|
|
@@ -127,8 +145,30 @@ bootstrapApplication(AppComponent, appConfig)
|
|
|
127
145
|
|
|
128
146
|
> **Identifying users is required.** Call `posthog.identify('your-user-id')` after login to link events to a known user. This is what connects frontend event captures, [session replays](/docs/session-replay.md), [LLM traces](/docs/ai-engineering.md), and [error tracking](/docs/error-tracking.md) to the same person — and lets backend events link back too.
|
|
129
147
|
>
|
|
148
|
+
> Use a stable ID from your auth system when possible, not an email or display name. Send those as person properties instead. If your app has no other stable key, email works as a fallback if they are unique. Never a shared literal like `"anonymous"` or `"user"`, which pools many people onto one person and corrupts their data. When no ID is available at all, skip the identify and retain the anonymous distinct ID that's automatically assigned.
|
|
149
|
+
>
|
|
150
|
+
> Call `posthog.reset()` on logout, so the next person to use the browser doesn't inherit the last one's identity.
|
|
151
|
+
>
|
|
130
152
|
> See our guide on [identifying users](/docs/getting-started/identify-users.md) for how to set this up.
|
|
131
153
|
|
|
154
|
+
If your app calls your own backend, `tracing_headers` adds `X-POSTHOG-DISTINCT-ID` and `X-POSTHOG-SESSION-ID` to matching `fetch` and `XMLHttpRequest` requests. This lets server-side SDKs link backend events, errors, and LLM traces back to frontend sessions and replays. Use hostnames only, without protocols or paths.
|
|
155
|
+
|
|
156
|
+
JavaScript
|
|
157
|
+
|
|
158
|
+
PostHog AI
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
posthog.init('<ph_project_token>', {
|
|
162
|
+
api_host: 'https://us.i.posthog.com',
|
|
163
|
+
// Optional: send PostHog session/user context to your backend
|
|
164
|
+
tracing_headers: ['api.example.com'],
|
|
165
|
+
})
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
This works in local development too, but match on the hostname alone: use `'localhost'`, not `'localhost:3000'`. Ports are never part of a hostname, so a value with one in it never matches anything. `localhost` and `127.0.0.1` are also different hostnames — use whichever your app actually calls.
|
|
169
|
+
|
|
170
|
+
Tracing headers help you attribute events across front and backend consistently. When this isn't available, use your server-side stable IDs to deduce the matching `distinctId`, and pass it in when capturing the event.
|
|
171
|
+
|
|
132
172
|
> **Note:** If you're using Typescript, you might have some trouble getting your types to compile because we depend on `rrweb` but don't ship all of their types. To accommodate that, you'll need to add `@rrweb/types@2.0.0-alpha.17` and `rrweb-snapshot@2.0.0-alpha.17` as a dependency if you want your Angular compiler to typecheck correctly.
|
|
133
173
|
>
|
|
134
174
|
> Given the nature of this library, you might need to completely clear your `.npm` cache to get this to work as expected. Make sure your clear your CI's cache as well.
|
|
@@ -359,7 +399,7 @@ Angular SSR does not allow Node.js code to be bundled into client-side component
|
|
|
359
399
|
|
|
360
400
|
## Next steps
|
|
361
401
|
|
|
362
|
-
For any technical questions for how to integrate specific PostHog features into Angular (such as feature flags, A/B testing, surveys, etc.), have a look at our [JavaScript Web SDK docs](/docs/libraries/js/
|
|
402
|
+
For any technical questions for how to integrate specific PostHog features into Angular (such as feature flags, A/B testing, surveys, etc.), have a look at our [JavaScript Web SDK docs](/docs/libraries/js/usage.md).
|
|
363
403
|
|
|
364
404
|
Alternatively, the following tutorials can help you get started:
|
|
365
405
|
|
|
@@ -367,10 +407,6 @@ Alternatively, the following tutorials can help you get started:
|
|
|
367
407
|
- [How to set up A/B tests in Angular](/tutorials/angular-ab-tests.md)
|
|
368
408
|
- [How to set up surveys in Angular](/tutorials/angular-surveys.md)
|
|
369
409
|
|
|
370
|
-
### Community questions
|
|
371
|
-
|
|
372
|
-
Ask a question
|
|
373
|
-
|
|
374
410
|
### Was this page useful?
|
|
375
411
|
|
|
376
412
|
HelpfulCould be better
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Astro - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Astro - Docs
|
|
2
8
|
|
|
3
9
|
PostHog makes it easy to get data about traffic and usage of your [Astro](https://astro.build/) app. Integrating PostHog into your site enables analytics about user behavior, custom events capture, session recordings, feature flags, and more.
|
|
@@ -44,6 +50,18 @@ PostHog AI
|
|
|
44
50
|
</script>
|
|
45
51
|
```
|
|
46
52
|
|
|
53
|
+
> **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:
|
|
54
|
+
>
|
|
55
|
+
> PostHog AI
|
|
56
|
+
>
|
|
57
|
+
> ```
|
|
58
|
+
> script-src 'self' https://*.posthog.com;
|
|
59
|
+
> connect-src 'self' https://*.posthog.com;
|
|
60
|
+
> worker-src 'self' blob: data:;
|
|
61
|
+
> ```
|
|
62
|
+
>
|
|
63
|
+
> `script-src` covers the snippet and the lazy-loaded bundles, `connect-src` covers event ingestion and feature flags, and `worker-src` covers session replay. The [toolbar needs a few more](/docs/advanced/content-security-policy.md), or use a [reverse proxy](/docs/advanced/proxy.md) so everything is first-party. Failing to do so causes silent failures where `capture` and `identify` calls never send, so the integration looks complete while zero events arrive. Remember `connect-src` falls back to `default-src`, so `default-src 'self'` blocks event delivery even when the script itself is bundled.
|
|
64
|
+
|
|
47
65
|
**Using with Astro's view transitions (ClientRouter)**
|
|
48
66
|
|
|
49
67
|
If you've opted in to Astro's `<ClientRouter>` component for client-side navigation, you'll need to add an initialization guard to prevent PostHog from running multiple times during page transitions.
|
|
@@ -120,8 +138,30 @@ import PostHogLayout from '../layouts/PostHogLayout.astro';
|
|
|
120
138
|
|
|
121
139
|
> **Identifying users is required.** Call `posthog.identify('your-user-id')` after login to link events to a known user. This is what connects frontend event captures, [session replays](/docs/session-replay.md), [LLM traces](/docs/ai-engineering.md), and [error tracking](/docs/error-tracking.md) to the same person — and lets backend events link back too.
|
|
122
140
|
>
|
|
141
|
+
> Use a stable ID from your auth system when possible, not an email or display name. Send those as person properties instead. If your app has no other stable key, email works as a fallback if they are unique. Never a shared literal like `"anonymous"` or `"user"`, which pools many people onto one person and corrupts their data. When no ID is available at all, skip the identify and retain the anonymous distinct ID that's automatically assigned.
|
|
142
|
+
>
|
|
143
|
+
> Call `posthog.reset()` on logout, so the next person to use the browser doesn't inherit the last one's identity.
|
|
144
|
+
>
|
|
123
145
|
> See our guide on [identifying users](/docs/getting-started/identify-users.md) for how to set this up.
|
|
124
146
|
|
|
147
|
+
If your app calls your own backend, `tracing_headers` adds `X-POSTHOG-DISTINCT-ID` and `X-POSTHOG-SESSION-ID` to matching `fetch` and `XMLHttpRequest` requests. This lets server-side SDKs link backend events, errors, and LLM traces back to frontend sessions and replays. Use hostnames only, without protocols or paths.
|
|
148
|
+
|
|
149
|
+
JavaScript
|
|
150
|
+
|
|
151
|
+
PostHog AI
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
posthog.init('<ph_project_token>', {
|
|
155
|
+
api_host: 'https://us.i.posthog.com',
|
|
156
|
+
// Optional: send PostHog session/user context to your backend
|
|
157
|
+
tracing_headers: ['api.example.com'],
|
|
158
|
+
})
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This works in local development too, but match on the hostname alone: use `'localhost'`, not `'localhost:3000'`. Ports are never part of a hostname, so a value with one in it never matches anything. `localhost` and `127.0.0.1` are also different hostnames — use whichever your app actually calls.
|
|
162
|
+
|
|
163
|
+
Tracing headers help you attribute events across front and backend consistently. When this isn't available, use your server-side stable IDs to deduce the matching `distinctId`, and pass it in when capturing the event.
|
|
164
|
+
|
|
125
165
|
Set up a reverse proxy (recommended)
|
|
126
166
|
|
|
127
167
|
We recommend [setting up a reverse proxy](/docs/advanced/proxy.md), so that events are less likely to be intercepted by tracking blockers.
|
|
@@ -148,7 +188,7 @@ These are public, stable IPs used by PostHog services (e.g., Celery tasks for sn
|
|
|
148
188
|
|
|
149
189
|
## Next steps
|
|
150
190
|
|
|
151
|
-
For any technical questions for how to integrate specific PostHog features into Astro (such as analytics, feature flags, A/B testing, surveys, etc.), have a look at our [JavaScript Web SDK docs](/docs/libraries/js/
|
|
191
|
+
For any technical questions for how to integrate specific PostHog features into Astro (such as analytics, feature flags, A/B testing, surveys, etc.), have a look at our [JavaScript Web SDK docs](/docs/libraries/js/usage.md).
|
|
152
192
|
|
|
153
193
|
Alternatively, the following tutorials can help you get started:
|
|
154
194
|
|
|
@@ -156,10 +196,6 @@ Alternatively, the following tutorials can help you get started:
|
|
|
156
196
|
- [How to set up A/B tests in Astro](/tutorials/astro-ab-tests.md)
|
|
157
197
|
- [How to set up surveys in Astro](/tutorials/astro-surveys.md)
|
|
158
198
|
|
|
159
|
-
### Community questions
|
|
160
|
-
|
|
161
|
-
Ask a question
|
|
162
|
-
|
|
163
199
|
### Was this page useful?
|
|
164
200
|
|
|
165
201
|
HelpfulCould be better
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# iOS SDK configuration - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# iOS SDK configuration - Docs
|
|
2
8
|
|
|
3
9
|
## Autocapture configuration
|
|
@@ -289,10 +295,7 @@ The [`PostHogConfig` object](https://github.com/PostHog/posthog-ios/blob/main/Po
|
|
|
289
295
|
| reuseAnonymousIdType: BooleanDefault: false | Whether the SDK should reuse the anonymous Id between user changes. When enabled, a single Id will be used for all anonymous users on this device. |
|
|
290
296
|
| surveysType: BooleanDefault: true | Enable Surveys. |
|
|
291
297
|
| setBeforeSendType: FunctionDefault: undefined | Hook that allows for amending, sampling, or dropping events before they are sent to PostHog. |
|
|
292
|
-
|
|
293
|
-
### Community questions
|
|
294
|
-
|
|
295
|
-
Ask a question
|
|
298
|
+
| bootstrapType: PostHogBootstrapConfigDefault: nil | Seeds identity (distinctId, isIdentifiedId) and feature-flag state (featureFlags, featureFlagPayloads) before the first /flags response. Bootstrapped identity applies to the first session; only enabled flags are served, until the first /flags response replaces them. See [SDK bootstrapping](/docs/libraries/bootstrapping.md#behavior-on-mobile-sdks). |
|
|
296
299
|
|
|
297
300
|
### Was this page useful?
|
|
298
301
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Django - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Django - Docs
|
|
2
8
|
|
|
3
9
|
PostHog makes it easy to get data about traffic and usage of your Django app. Integrating PostHog enables analytics, custom events capture, feature flags, error tracking, and more.
|
|
@@ -14,12 +20,12 @@ Install PostHog for Django in seconds with our wizard by running this prompt wit
|
|
|
14
20
|
|
|
15
21
|
Or, to integrate manually, continue with the rest of this guide.
|
|
16
22
|
|
|
23
|
+
> These docs cover version `7.x` of the Python SDK, which requires Python 3.10 or higher. On Python 3.9? See [supported versions](#supported-versions).
|
|
24
|
+
|
|
17
25
|
## Installation
|
|
18
26
|
|
|
19
27
|
To start, run `pip install posthog` to install PostHog’s Python SDK.
|
|
20
28
|
|
|
21
|
-
> **Note:** Version `7.x` of the PostHog Python SDK requires Python 3.10 or higher.
|
|
22
|
-
|
|
23
29
|
Then, configure PostHog in your app config so it's initialized when Django starts:
|
|
24
30
|
|
|
25
31
|
your\_app/apps.py
|
|
@@ -90,6 +96,8 @@ Events captured without a context or explicit `distinct_id` are sent as [anonymo
|
|
|
90
96
|
> capture("foo_viewed")
|
|
91
97
|
> return {"status": "ok"}
|
|
92
98
|
> ```
|
|
99
|
+
>
|
|
100
|
+
> When possible, write a small piece of **middleware** that resolves your authenticated user, wrap a context around the request, and identifies it. Every `capture()` downstream is then attributed *automatically*. The SDK's Django middleware does this automatically and you can replicate it when using the plain Python SDK.
|
|
93
101
|
|
|
94
102
|
## Django contexts middleware
|
|
95
103
|
|
|
@@ -128,7 +136,28 @@ The session and distinct ID headers are sanitized before use. Empty values are i
|
|
|
128
136
|
|
|
129
137
|
All events captured during the request (including exceptions) include these properties and are associated with the extracted session and distinct ID.
|
|
130
138
|
|
|
131
|
-
|
|
139
|
+
### Login and signup views
|
|
140
|
+
|
|
141
|
+
The middleware reads `request.user` once, before your view runs. On a login or signup request the visitor is still anonymous at that point, so the request's context has no distinct ID. Calling `login()` inside the view doesn't change that. Everything captured during that request stays anonymous, including the login event itself.
|
|
142
|
+
|
|
143
|
+
Identify the context from inside the request once you know who the user is. Django's auth signals are the natural place:
|
|
144
|
+
|
|
145
|
+
Python
|
|
146
|
+
|
|
147
|
+
PostHog AI
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from django.contrib.auth.signals import user_logged_in
|
|
151
|
+
from django.dispatch import receiver
|
|
152
|
+
from posthog import identify_context
|
|
153
|
+
@receiver(user_logged_in)
|
|
154
|
+
def identify_posthog_user(sender, request, user, **kwargs):
|
|
155
|
+
identify_context(str(user.pk))
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Every capture later in that request is then attributed to the user who just logged in. Requests made after login don't need this. The middleware sees the authenticated user from the start.
|
|
159
|
+
|
|
160
|
+
If you're using [PostHog JavaScript Web](/docs/libraries/js.md) on the frontend, configure [`tracing_headers`](/docs/libraries/js/config.md#tracing-headers) for your Django backend hostname so browser requests include the session and distinct ID headers.
|
|
132
161
|
|
|
133
162
|
### Exception capture
|
|
134
163
|
|
|
@@ -254,9 +283,13 @@ Alternatively, the following tutorials can help you get started:
|
|
|
254
283
|
- [Setting up Django analytics, feature flags, and more](/tutorials/django-analytics.md)
|
|
255
284
|
- [How to set up A/B tests in Django](/tutorials/django-ab-tests.md)
|
|
256
285
|
|
|
257
|
-
|
|
286
|
+
## Supported versions
|
|
287
|
+
|
|
288
|
+
These docs cover version `7.x` of the PostHog Python SDK, which requires Python 3.10 or higher. Python 3.9 is no longer supported on `7.x.x` and higher — pin to the 6.x line with `pip install 'posthog<7'`, where `6.9.3` is the final release.
|
|
289
|
+
|
|
290
|
+
Everything on this page works the same way on `6.9.3`. Event capture, the context API (`new_context`, `identify_context`, `set_context_session`), and `PosthogContextMiddleware` are identical on `6.9.3` and `7.0.0` — `7.0.0` only dropped Python 3.9 and bumped the optional LLM provider SDKs. That includes the middleware identifying the request context from the `X-POSTHOG-DISTINCT-ID` header and falling back to the authenticated user, which behaves the same across both lines.
|
|
258
291
|
|
|
259
|
-
|
|
292
|
+
Later `7.x` releases add what the 6.x line does not receive, such as the Celery integration, tracing header sanitization, and `set_context_device_id`. They also changed the middleware's own captured properties: `7.x` sends the request IP as `$ip`, where `6.9.3` sends it as `$ip_address`, and `7.x` additionally captures `$request_path`, `$raw_user_agent`, and the authenticated user's `email`.
|
|
260
293
|
|
|
261
294
|
### Was this page useful?
|
|
262
295
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# .NET - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# .NET - Docs
|
|
2
8
|
|
|
3
9
|
This is an optional library you can install if you're working with .NET Core. It uses an internal queue to make calls fast and non-blocking. It also batches requests and flushes asynchronously, making it perfect to use in any part of your web app or other server side application that needs performance.
|
|
@@ -366,6 +372,10 @@ For the full setup guide, see the [.NET error tracking installation docs](/docs/
|
|
|
366
372
|
|
|
367
373
|
Automatic exception capture is not available in the .NET SDK yet.
|
|
368
374
|
|
|
375
|
+
## Logs
|
|
376
|
+
|
|
377
|
+
[PostHog Logs](/docs/logs.md) doesn't use this SDK. Logs are ingested over OpenTelemetry, so you attach an OTLP exporter to the standard `ILogger` pipeline instead — see the [.NET logs installation guide](/docs/logs/installation/dotnet.md).
|
|
378
|
+
|
|
369
379
|
## Person profiles and properties
|
|
370
380
|
|
|
371
381
|
The .NET SDK captures identified events by default. These create [person profiles](/docs/data/persons.md). To set [person properties](/docs/data/user-properties.md) in these profiles, include them when capturing an event:
|
|
@@ -754,10 +764,6 @@ By default, the library buffers events before sending them to the `/batch` endpo
|
|
|
754
764
|
|
|
755
765
|
To avoid this, call `await posthog.FlushAsync()` after processing every request by adding it as a middleware to your server. This allows `posthog.Capture()` to remain asynchronous for better performance.
|
|
756
766
|
|
|
757
|
-
### Community questions
|
|
758
|
-
|
|
759
|
-
Ask a question
|
|
760
|
-
|
|
761
767
|
### Was this page useful?
|
|
762
768
|
|
|
763
769
|
HelpfulCould be better
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Elixir - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Elixir - Docs
|
|
2
8
|
|
|
3
9
|
This library provides an Elixir HTTP client for PostHog. [See the repository](https://github.com/posthog/posthog-elixir) for more information.
|
|
@@ -405,10 +411,6 @@ PostHog.capture(AnotherPostHog, "user_signed_up", %{distinct_id: "user123"})
|
|
|
405
411
|
|
|
406
412
|
The library is maintained by the PostHog team since February 2025. Thanks to [nkezhaya](https://github.com/nkezhaya) for contributing v0.1.0. Thanks to [martosaur](https://github.com/martosaur) for contributing v2.0.0.
|
|
407
413
|
|
|
408
|
-
### Community questions
|
|
409
|
-
|
|
410
|
-
Ask a question
|
|
411
|
-
|
|
412
414
|
### Was this page useful?
|
|
413
415
|
|
|
414
416
|
HelpfulCould be better
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Flask - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Flask - Docs
|
|
2
8
|
|
|
3
9
|
PostHog makes it easy to get data about traffic and usage of your Flask app. Integrating PostHog enables analytics, custom events capture, feature flags, error tracking, and more.
|
|
4
10
|
|
|
5
11
|
This guide walks you through integrating PostHog into your Flask app using the [Python SDK](/docs/libraries/python.md).
|
|
6
12
|
|
|
13
|
+
> These docs cover version `7.x` of the Python SDK, which requires Python 3.10 or higher. On Python 3.9? See [supported versions](#supported-versions).
|
|
14
|
+
|
|
7
15
|
## Installation
|
|
8
16
|
|
|
9
17
|
To start, run `pip install posthog` to install PostHog’s Python SDK.
|
|
10
18
|
|
|
11
|
-
> **Note:** Version `7.x` of the PostHog Python SDK requires Python 3.10 or higher.
|
|
12
|
-
|
|
13
19
|
Then, initialize PostHog where you'd like to use it. For example, here's how to capture an event in a simple route:
|
|
14
20
|
|
|
15
21
|
app.py
|
|
@@ -54,12 +60,14 @@ You can find your project token and instance address in [your project settings](
|
|
|
54
60
|
> capture("foo_viewed")
|
|
55
61
|
> return {"status": "ok"}
|
|
56
62
|
> ```
|
|
63
|
+
>
|
|
64
|
+
> When possible, write a small piece of **middleware** that resolves your authenticated user, wrap a context around the request, and identifies it. Every `capture()` downstream is then attributed *automatically*. The SDK's Django middleware does this automatically and you can replicate it when using the plain Python SDK.
|
|
57
65
|
|
|
58
66
|
## Request contexts
|
|
59
67
|
|
|
60
68
|
Use [contexts](/docs/libraries/python.md#contexts) to share identity, session IDs, and tags across multiple captures during a request.
|
|
61
69
|
|
|
62
|
-
If you're using [PostHog
|
|
70
|
+
If you're using [PostHog JavaScript Web](/docs/libraries/js.md) on the frontend, configure [`tracing_headers`](/docs/libraries/js/config.md#tracing-headers) for your Flask backend hostname so browser requests include the session and distinct ID headers.
|
|
63
71
|
|
|
64
72
|
Then read the incoming headers in your Flask request handler. Tracing headers are client-controlled analytics context, not authentication or authorization, so prefer your authenticated user ID when one is available:
|
|
65
73
|
|
|
@@ -122,9 +130,13 @@ Alternatively, the following tutorials can help you get started:
|
|
|
122
130
|
- [How to set up feature flags in Python and Flask](/tutorials/python-feature-flags.md)
|
|
123
131
|
- [How to set up A/B tests in Python and Flask](/tutorials/python-ab-testing.md)
|
|
124
132
|
|
|
125
|
-
|
|
133
|
+
## Supported versions
|
|
134
|
+
|
|
135
|
+
These docs cover version `7.x` of the PostHog Python SDK, which requires Python 3.10 or higher. Python 3.9 is no longer supported on `7.x.x` and higher — pin to the 6.x line with `pip install 'posthog<7'`, where `6.9.3` is the final release.
|
|
136
|
+
|
|
137
|
+
Everything on this page works the same way on `6.9.3`. Event capture, the context API (`new_context`, `identify_context`, `set_context_session`), and `PosthogContextMiddleware` are identical on `6.9.3` and `7.0.0` — `7.0.0` only dropped Python 3.9 and bumped the optional LLM provider SDKs. That includes the middleware identifying the request context from the `X-POSTHOG-DISTINCT-ID` header and falling back to the authenticated user, which behaves the same across both lines.
|
|
126
138
|
|
|
127
|
-
|
|
139
|
+
Later `7.x` releases add what the 6.x line does not receive, such as the Celery integration, tracing header sanitization, and `set_context_device_id`. They also changed the middleware's own captured properties: `7.x` sends the request IP as `$ip`, where `6.9.3` sends it as `$ip_address`, and `7.x` additionally captures `$request_path`, `$raw_user_agent`, and the authenticated user's `email`.
|
|
128
140
|
|
|
129
141
|
### Was this page useful?
|
|
130
142
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Flutter - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Flutter - Docs
|
|
2
8
|
|
|
3
9
|
This is an optional library you can install if you're working with Flutter. It uses an internal queue to make calls fast and non-blocking. It also batches requests and flushes asynchronously, making it perfect to use in any part of your mobile app.
|
|
@@ -605,6 +611,43 @@ PostHog AI
|
|
|
605
611
|
await Posthog().reloadFeatureFlags();
|
|
606
612
|
```
|
|
607
613
|
|
|
614
|
+
### Bootstrapping flags
|
|
615
|
+
|
|
616
|
+
Since there is a delay between initializing PostHog and fetching feature flags, feature flags are not always available immediately. This makes them unusable if you want to do something like redirecting a user to a different page based on a feature flag.
|
|
617
|
+
|
|
618
|
+
To have your feature flags available immediately, you can initialize PostHog with precomputed values until it has had a chance to fetch them. This is called bootstrapping. After the SDK fetches feature flags from PostHog, it will use those flag values instead of bootstrapped ones.
|
|
619
|
+
|
|
620
|
+
Set `config.bootstrap` before calling `setup()` to seed identity and flag values before the first `/flags` response (requires the Flutter SDK `5.31.0`+):
|
|
621
|
+
|
|
622
|
+
Dart
|
|
623
|
+
|
|
624
|
+
PostHog AI
|
|
625
|
+
|
|
626
|
+
```dart
|
|
627
|
+
final config = PostHogConfig('<ph_project_token>');
|
|
628
|
+
config.host = 'https://us.i.posthog.com';
|
|
629
|
+
config.bootstrap = PostHogBootstrapConfig(
|
|
630
|
+
distinctId: 'distinct_id_of_your_user',
|
|
631
|
+
isIdentifiedId: true,
|
|
632
|
+
featureFlags: {
|
|
633
|
+
'flag-1': true,
|
|
634
|
+
'variant-flag': 'control',
|
|
635
|
+
},
|
|
636
|
+
);
|
|
637
|
+
await Posthog().setup(config);
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
The values are forwarded to the native iOS and Android SDKs:
|
|
641
|
+
|
|
642
|
+
- **Bootstrapped identity applies during setup.** On a fresh install, setting it before `setup()` means events captured synchronously during initialization (like `Application Installed`) carry your distinct ID instead of the SDK-generated UUID.
|
|
643
|
+
- An **anonymous** bootstrap (`isIdentifiedId: false`, the default) seeds the anonymous ID only when none is persisted yet. Once an anonymous ID exists on disk, or the person has been identified, the SDK ignores it.
|
|
644
|
+
- An **identified** bootstrap (`isIdentifiedId: true`) is for a signed-in identity available to your app (for example, from a backend session token). On a fresh install, it seeds the distinct ID, marks the person identified, and generates a separate device ID. On a returning install, a matching anonymous ID is marked identified without emitting `$identify`; a different anonymous ID is merged via `identify()` when person profiles are enabled. This emits `$identify` unless capturing is opted out. A different, already-identified person is left untouched.
|
|
645
|
+
- **Bootstrapped flags are served until the first `/flags` response, then replaced.** A complete `/flags` response takes over entirely, so bootstrapped-only keys don't persist past it. Only *enabled* flags are seeded: a `true` boolean or a non-empty variant string. A `false` or empty value is dropped, matching posthog-js. Seed payloads with the separate `featureFlagPayloads` option. Flag values and payloads must be JSON-serializable, or they're dropped. Bootstrapped flags are cleared on `reset()`.
|
|
646
|
+
|
|
647
|
+
The feature-flags-loaded signal fires as soon as bootstrapped flags are applied, so startup logic can read them immediately. These SDKs don't support the `sessionID` bootstrap option. When person profiles are set to `never`, the SDK preserves a different anonymous identity instead of merging it into an identified bootstrap.
|
|
648
|
+
|
|
649
|
+
On Flutter web, `bootstrap` is not applied, so configure it in your `posthog.init({...})` snippet instead. See the [SDK bootstrapping guide](/docs/libraries/bootstrapping.md) for the cross-SDK overview.
|
|
650
|
+
|
|
608
651
|
### Setting properties for flag evaluation
|
|
609
652
|
|
|
610
653
|
If a flag targets person or group properties, you can send those properties inline with the next flag evaluation request instead of waiting for a `$set` event to be ingested. This avoids the race where a flag returns a stale value right after you set a property.
|
|
@@ -647,12 +690,18 @@ To set up [session replay web](/docs/session-replay.md) or [mobile session repla
|
|
|
647
690
|
|
|
648
691
|
If you're using Flutter Web, also enable the [Canvas capture](/docs/session-replay/canvas-recording.md) in [your project settings](https://us.posthog.com/settings/project-replay). This is needed as Flutter renders your app using a browser canvas element.
|
|
649
692
|
|
|
693
|
+
On Flutter Web, masking (`maskAllTexts`, `maskAllImages`, `PostHogMaskWidget`) applies inside that canvas too — declare `session_recording.canvasCapture.maskRegionsFn` in the `posthog.init` call in your `web/index.html` to enable it (requires PostHog Flutter SDK 5.34.0+ and posthog-js 1.408.0+). See [masking on Flutter Web](/docs/session-replay/privacy.md) under the Flutter tab.
|
|
694
|
+
|
|
650
695
|
## Surveys
|
|
651
696
|
|
|
652
697
|
> **Note:** Surveys are supported in Flutter for **Web**, **iOS**, and **Android** platforms.
|
|
653
698
|
|
|
654
699
|
[Surveys](/docs/surveys.md) launched with [popover presentation](/docs/surveys/creating-surveys.md#presentation) are automatically shown to users matching the [display conditions](/docs/surveys/creating-surveys.md#display-conditions) you set up.
|
|
655
700
|
|
|
701
|
+
## Push notifications
|
|
702
|
+
|
|
703
|
+
The Flutter SDK can register a device for [Workflows](/docs/workflows.md) push notifications and capture when a user opens one. For setup, including automatic and manual registration, capturing opens, opting out, and identity verification, see [Push notifications](/docs/workflows/push-notifications.md).
|
|
704
|
+
|
|
656
705
|
## Flush
|
|
657
706
|
|
|
658
707
|
You can configure how many events queue before flushing with `flushAt`. Setting this to `1` will send events immediately and will use more battery. The default is `20`.
|
|
@@ -836,10 +885,6 @@ await Posthog().debug(true);
|
|
|
836
885
|
await Posthog().debug(false);
|
|
837
886
|
```
|
|
838
887
|
|
|
839
|
-
### Community questions
|
|
840
|
-
|
|
841
|
-
Ask a question
|
|
842
|
-
|
|
843
888
|
### Was this page useful?
|
|
844
889
|
|
|
845
890
|
HelpfulCould be better
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Go - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Go - Docs
|
|
2
8
|
|
|
3
9
|
This library uses an internal queue to make calls fast and non-blocking. It also batches requests and flushes asynchronously, making it perfect to use in any part of your web app or other server-side application that needs performance.
|
|
@@ -558,10 +564,6 @@ The `name` is a special property which is used in the PostHog UI for the name of
|
|
|
558
564
|
|
|
559
565
|
This library is largely based on the `analytics-go` package.
|
|
560
566
|
|
|
561
|
-
### Community questions
|
|
562
|
-
|
|
563
|
-
Ask a question
|
|
564
|
-
|
|
565
567
|
### Was this page useful?
|
|
566
568
|
|
|
567
569
|
HelpfulCould be better
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Identify users - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Identify users - Docs
|
|
2
8
|
|
|
3
9
|
Linking events to specific users enables you to build a full picture of how they're using your product across different sessions, devices, and platforms.
|
|
4
10
|
|
|
5
11
|
This is straightforward to do when [capturing backend events](/docs/product-analytics/capture-events?tab=Node.js.md), as you associate events to a specific user using a `distinct_id`, which is a required argument.
|
|
6
12
|
|
|
7
|
-
However, in the frontend of a [web](/docs/libraries/js/
|
|
13
|
+
However, in the frontend of a [web](/docs/libraries/js/usage.md#capturing-events) or [mobile app](/docs/libraries/ios.md#capturing-events), a `distinct_id` is not a required argument — PostHog's SDKs will generate an anonymous `distinct_id` for you automatically and you can capture events anonymously, provided you use the appropriate [configuration](/docs/libraries/js/usage.md#capturing-anonymous-events).
|
|
8
14
|
|
|
9
15
|
To link events to specific users, call `identify`:
|
|
10
16
|
|
|
@@ -94,6 +100,31 @@ You only need to call `identify` once per session, and you should avoid calling
|
|
|
94
100
|
|
|
95
101
|
If you call `identify` multiple times with the same data without reloading the page in between, PostHog will ignore the subsequent calls.
|
|
96
102
|
|
|
103
|
+
#### Identify users when the web SDK loads
|
|
104
|
+
|
|
105
|
+
If your app already knows the signed-in user when you initialize the JavaScript web SDK, the [`loaded` callback](/docs/libraries/js/config.md) is a convenient place to call `identify`. This identifies the user as soon as the SDK has loaded:
|
|
106
|
+
|
|
107
|
+
Web
|
|
108
|
+
|
|
109
|
+
PostHog AI
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
posthog.init('<ph_project_token>', {
|
|
113
|
+
api_host: 'https://us.i.posthog.com',
|
|
114
|
+
defaults: '2026-05-30',
|
|
115
|
+
loaded: (posthog) => {
|
|
116
|
+
if (currentUser?.id) {
|
|
117
|
+
posthog.identify(currentUser.id, {
|
|
118
|
+
email: currentUser.email,
|
|
119
|
+
name: currentUser.name,
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
In this example, `currentUser` represents user data already available from your authentication system. If your app loads the user asynchronously, call `posthog.identify()` as soon as that data becomes available instead.
|
|
127
|
+
|
|
97
128
|
### 2\. Use unique strings for distinct IDs
|
|
98
129
|
|
|
99
130
|
If two users have the same distinct ID, their data is merged and they are considered one user in PostHog. Two common ways this can happen are:
|
|
@@ -165,6 +196,10 @@ Whenever possible, we recommend passing in all person properties you have availa
|
|
|
165
196
|
|
|
166
197
|
Person properties can also be set being adding a `$set` property to a event `capture` call.
|
|
167
198
|
|
|
199
|
+
**\`$set\` and \`$set\_once\` aren't stored on events**
|
|
200
|
+
|
|
201
|
+
These properties only tell PostHog how to update person data during ingestion — they aren't kept on the stored event, so you can't filter, break down, or query events by them. To query the values you set, use [person properties](/docs/product-analytics/person-properties.md) instead.
|
|
202
|
+
|
|
168
203
|
See our [person properties docs](/docs/product-analytics/person-properties.md) for more details on how to work with them and best practices.
|
|
169
204
|
|
|
170
205
|
### 5\. Use deep links between platforms
|
|
@@ -183,8 +218,8 @@ In these cases, you can use a [deep link](https://developer.android.com/training
|
|
|
183
218
|
2. Add the distinct ID to the deep link as query parameters, along with other properties like UTM parameters.
|
|
184
219
|
3. When the user is redirected to the app, parse the deep link and handle the following cases:
|
|
185
220
|
|
|
186
|
-
- The mobile app is already authenticated. In this case, call [`posthog.alias()`](/docs/libraries/js/
|
|
187
|
-
- The mobile app is unauthenticated. In this case, call [`posthog.identify()`](/docs/libraries/js/
|
|
221
|
+
- The mobile app is already authenticated. In this case, call [`posthog.alias()`](/docs/libraries/js/usage.md#alias) with the distinct ID from the web. This associates the two distinct IDs as a single person.
|
|
222
|
+
- The mobile app is unauthenticated. In this case, call [`posthog.identify()`](/docs/libraries/js/usage.md#identifying-users) with the distinct ID from the web so pre-login mobile events stay connected to the web session. When the user later logs in on mobile, call `identify()` again with your canonical user ID.
|
|
188
223
|
|
|
189
224
|
As long as you associate the distinct IDs with `posthog.identify()` or `posthog.alias()`, you can track events generated across platforms.
|
|
190
225
|
|
|
@@ -263,10 +298,6 @@ object DeepLinkIdentityManager {
|
|
|
263
298
|
- [How person processing works](/docs/how-posthog-works/ingestion-pipeline.md#2-person-processing)
|
|
264
299
|
- [An introductory guide to identifying users in PostHog](/tutorials/identifying-users-guide.md)
|
|
265
300
|
|
|
266
|
-
### Community questions
|
|
267
|
-
|
|
268
|
-
Ask a question
|
|
269
|
-
|
|
270
301
|
### Was this page useful?
|
|
271
302
|
|
|
272
303
|
HelpfulCould be better
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# iOS - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# iOS - Docs
|
|
2
8
|
|
|
3
9
|
The PostHog iOS SDK is a library that you can use to track events, identify users, record session replays, evaluate feature flags, run experiments, build surveys, and more.
|
|
@@ -106,6 +112,10 @@ struct YourGreatApp: App {
|
|
|
106
112
|
|
|
107
113
|
> **Identifying users is required.** Call `posthog.identify('your-user-id')` after login to link events to a known user. This is what connects frontend event captures, [session replays](/docs/session-replay.md), [LLM traces](/docs/ai-engineering.md), and [error tracking](/docs/error-tracking.md) to the same person — and lets backend events link back too.
|
|
108
114
|
>
|
|
115
|
+
> Use a stable ID from your auth system when possible, not an email or display name. Send those as person properties instead. If your app has no other stable key, email works as a fallback if they are unique. Never a shared literal like `"anonymous"` or `"user"`, which pools many people onto one person and corrupts their data. When no ID is available at all, skip the identify and retain the anonymous distinct ID that's automatically assigned.
|
|
116
|
+
>
|
|
117
|
+
> Call `posthog.reset()` on logout, so the next person to use the browser doesn't inherit the last one's identity.
|
|
118
|
+
>
|
|
109
119
|
> See our guide on [identifying users](/docs/getting-started/identify-users.md) for how to set this up.
|
|
110
120
|
|
|
111
121
|
## Offline behavior
|
|
@@ -138,6 +148,10 @@ Method swizzling is particularly important for accurate session metrics tracking
|
|
|
138
148
|
|
|
139
149
|
You can learn more about configuring method swizzling in the [configuration page](/docs/libraries/ios/configuration.md#method-swizzling).
|
|
140
150
|
|
|
151
|
+
## Push notifications
|
|
152
|
+
|
|
153
|
+
The iOS SDK can register a device for [Workflows](/docs/workflows.md) push notifications and capture when a user opens one. For setup, including automatic and manual registration, capturing opens, and identity verification, see [Push notifications](/docs/workflows/push-notifications.md).
|
|
154
|
+
|
|
141
155
|
## Next steps
|
|
142
156
|
|
|
143
157
|
Now that you've installed the SDK, explore the configuration and usage options:
|
|
@@ -145,10 +159,6 @@ Now that you've installed the SDK, explore the configuration and usage options:
|
|
|
145
159
|
- [Learn about using all of the features of PostHog with iOS SDK](/docs/libraries/ios/usage.md)
|
|
146
160
|
- [Learn about configuration options for the iOS SDK](/docs/libraries/ios/configuration.md)
|
|
147
161
|
|
|
148
|
-
### Community questions
|
|
149
|
-
|
|
150
|
-
Ask a question
|
|
151
|
-
|
|
152
162
|
### Was this page useful?
|
|
153
163
|
|
|
154
164
|
HelpfulCould be better
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
|
|
2
|
+
|
|
3
|
+
# Laravel - Docs
|
|
4
|
+
|
|
5
|
+
Copy page
|
|
6
|
+
|
|
1
7
|
# Laravel - Docs
|
|
2
8
|
|
|
3
9
|
PostHog integrates with Laravel through the [PostHog PHP SDK](/docs/libraries/php.md). This page covers Laravel-specific setup. For SDK features such as event capture, identifying users, feature flags, group analytics, and configuration options, see the [PHP SDK docs](/docs/libraries/php.md).
|
|
@@ -161,10 +167,6 @@ PostHog::init(
|
|
|
161
167
|
|
|
162
168
|
See the [PHP SDK docs](/docs/libraries/php.md) for usage examples and the full API reference.
|
|
163
169
|
|
|
164
|
-
### Community questions
|
|
165
|
-
|
|
166
|
-
Ask a question
|
|
167
|
-
|
|
168
170
|
### Was this page useful?
|
|
169
171
|
|
|
170
172
|
HelpfulCould be better
|