From 14dd40c3f2aadfb479aef068079bcaa2a7cd4a4e Mon Sep 17 00:00:00 2001 From: waleed Date: Fri, 3 Apr 2026 01:20:34 -0700 Subject: [PATCH] fix(analytics): add posthog ingest proxy rewrites and document env vars --- apps/sim/.env.example | 5 +++++ apps/sim/next.config.ts | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/apps/sim/.env.example b/apps/sim/.env.example index fe9514e358e..a7d16b31acf 100644 --- a/apps/sim/.env.example +++ b/apps/sim/.env.example @@ -41,3 +41,8 @@ API_ENCRYPTION_KEY=your_api_encryption_key # Use `openssl rand -hex 32` to gener # Admin API (Optional - for self-hosted GitOps) # ADMIN_API_KEY= # Use `openssl rand -hex 32` to generate. Enables admin API for workflow export/import. # Usage: curl -H "x-admin-key: your_key" https://your-instance/api/v1/admin/workspaces + +# Product Analytics - PostHog (Optional) +# NEXT_PUBLIC_POSTHOG_KEY=phc_... # Your PostHog project API key (from posthog.com or self-hosted) +# NEXT_PUBLIC_POSTHOG_ENABLED=true # Set to true to enable analytics. Omit or set to false to disable entirely. + # When disabled: server SDK never initializes, client SDK never loads. diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index e98d268c7bf..f84f26d1884 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -417,6 +417,14 @@ const nextConfig: NextConfig = { source: '/r/:shortCode', destination: 'https://go.trybeluga.ai/:shortCode', }, + { + source: '/ingest/static/:path*', + destination: 'https://us-assets.i.posthog.com/static/:path*', + }, + { + source: '/ingest/:path*', + destination: 'https://us.i.posthog.com/:path*', + }, ] }, }