Commit 6b24fed
committed
posthog migration: part 1 (#7363)
# Migrate to PostHog US Instance
This PR updates our PostHog integration across all apps to use the US-based PostHog instance instead of the previous self-hosted solution. Key changes include:
- Upgraded PostHog JS SDK from 1.67.1 to 1.252.0
- Added API proxying via Next.js rewrites to route PostHog requests through `/_ph` endpoints
- Implemented a new initialization approach using `instrumentation-client.ts` files
- Removed custom PostHog components and providers in favor of the official SDK's auto-capture functionality
- Configured PostHog to capture page views on history changes automatically
- Disabled session recording and exception capturing for privacy and performance
- Removed the `flat` dependency which is no longer needed
These changes will provide more reliable analytics while improving performance by using PostHog's official CDN and modern SDK features.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Added support for proxying analytics-related requests to external services across multiple apps, enabling seamless integration with analytics providers.
- **Chores**
- Upgraded the analytics library dependency to the latest version in several apps.
- Updated environment variable examples to support new analytics configuration.
- **Refactor**
- Replaced in-app analytics instrumentation with new centralized clients for improved control and consistency.
- **Bug Fixes**
- Minor CSS z-index syntax adjustments for improved styling consistency.
- **Removed**
- Eliminated legacy analytics components and tracking from layouts, providers, hooks, and feedback forms, simplifying application structure and reducing external tracking.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on the removal of several `Posthog` components and their related files across multiple applications, as well as updating the `posthog-js` library version to `1.252.0`. It also introduces new `rewrites` in various configuration files to accommodate the updated tracking.
### Detailed summary
- Deleted files related to `Posthog` from:
- `apps/portal/src/lib/env.ts`
- `apps/portal/src/lib/posthog/Posthog.tsx`
- `apps/dashboard/src/lib/posthog/Posthog.tsx`
- `apps/playground-web/src/lib/posthog/Posthog.tsx`
- `apps/dashboard/src/components/wallets/PosthogIdentifier.tsx`
- Updated `posthog-js` version to `1.252.0` in:
- `apps/nebula/package.json`
- `apps/playground-web/package.json`
- `apps/portal/package.json`
- `apps/dashboard/package.json`
- Added `NEXT_PUBLIC_POSTHOG_KEY` and `NEXT_PUBLIC_POSTHOG_HOST` to `apps/nebula/.env.example`.
- Introduced new `rewrites` in `next.config.mjs` for `apps/playground-web`, `apps/dashboard`, `apps/nebula`, and `apps/portal` to direct traffic for `Posthog`.
- Removed `Posthog` components from various layouts and providers, simplifying the structure in `apps/dashboard/src/app/pay/components/client/Providers.client.tsx` and `apps/dashboard/src/app/bridge/components/client/Providers.client.tsx`.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->1 parent cc3fbba commit 6b24fed
File tree
38 files changed
+287
-534
lines changed- apps
- dashboard
- src
- app
- (app)
- team/[team_slug]
- bridge/components/client
- pay/components/client
- components/wallets
- hooks/analytics
- lib/posthog
- utils
- nebula
- src
- playground-web
- src
- app
- lib/posthog
- portal
- src
- app
- components
- code
- others
- lib
- posthog
- wallet-ui
38 files changed
+287
-534
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
149 | 161 | | |
150 | 162 | | |
151 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| |||
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
| 79 | + | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 4 | | |
8 | 5 | | |
9 | 6 | | |
| |||
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
64 | | - | |
65 | 61 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
84 | 75 | | |
85 | 76 | | |
86 | 77 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
Lines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 15 | + | |
| 16 | + | |
22 | 17 | | |
23 | 18 | | |
24 | 19 | | |
| |||
Lines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 8 | + | |
| 9 | + | |
15 | 10 | | |
16 | 11 | | |
17 | 12 | | |
Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 0 additions & 17 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | 3 | | |
| |||
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | | - | |
| 10 | + | |
13 | 11 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
45 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments