:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
docs(aio): document posthog_ custom metadata for vercel and traceloop (#73587)
Radu Raicea5bbe66bbd027
diff --git a/docs/onboarding/ai-observability/vercel-ai.tsx b/docs/onboarding/ai-observability/vercel-ai.tsxindex b230860940cb..88068f1c2314 100644--- a/docs/onboarding/ai-observability/vercel-ai.tsx+++ b/docs/onboarding/ai-observability/vercel-ai.tsx@@ -83,6 +83,7 @@ export const getVercelAISteps = (ctx: OnboardingComponentsContext): StepDefinitifunctionId: 'my-ai-function',metadata: {posthog_distinct_id: 'user_123', // optional+ posthog_environment: 'production', // custom property: sets "environment" on the event},},})@@ -99,6 +100,15 @@ export const getVercelAISteps = (ctx: OnboardingComponentsContext): StepDefiniti</Markdown></Blockquote>+ <Blockquote>+ <Markdown>+ **Custom properties:** Prefix any telemetry metadata field with `posthog_` to attach it to+ the `$ai_generation` event as a custom property. The prefix is stripped, so+ `posthog_environment` becomes an `environment` property you can filter and break down by.+ Other metadata fields aren't captured.+ </Markdown>+ </Blockquote>+<Markdown>{dedent`You can expect captured \`$ai_generation\` events to have the following properties:diff --git a/docs/onboarding/product-analytics/traceloop.tsx b/docs/onboarding/product-analytics/traceloop.tsxindex d097340ee5ff..4063d4010360 100644--- a/docs/onboarding/product-analytics/traceloop.tsx+++ b/docs/onboarding/product-analytics/traceloop.tsx@@ -58,6 +58,29 @@ export const getTraceloopSteps = (ctx: OnboardingComponentsContext): StepDefinit</>),},+ {+ title: 'Send custom properties (optional)',+ badge: 'optional',+ content: (+ <>+ <Markdown>+ Prefix any Traceloop association property with `posthog_` to attach it to the exported event as+ a custom property. The prefix is stripped, so `posthog_environment` becomes an `environment`+ property you can filter and break down by in PostHog.+ </Markdown>+ <CodeBlock+ language="typescript"+ code={dedent`+ import { withAssociationProperties } from '@traceloop/node-server-sdk'++ withAssociationProperties({ posthog_environment: 'production' }, () => {+ // your LLM calls here+ })+ `}+ />+ </>+ ),+ },]}