Skip to content

Commit 43e054f

Browse files
ivovahsanv
andauthored
feat(editor, core): Integrate PostHog (#3865)
* Integrate PostHog - Part 1: Groundwork (#3753) * Integrate PostHog - Part 2: Event capture (#3779) * Integrate PostHog - Part 3: Session recordings (#3789) * Integrate PostHog - Part 4: Experiments (#3825) * Finalize PostHog integration (#3866) * 📦 Update `package-lock.json` * 🐛 Account for absent PH hooks file * ✨ Create new env `EXTERNAL_FRONTEND_HOOKS_FILES` * ⚡ Adjust env used for injecting PostHog * 🐛 Switch to semicolon delimiter * ⚡ Simplify to `externalFrontendHookPath` * Refactor FE hooks flow (#3884) * Add env var for session recordings * inject frontend hooks even when telemetry is off * allow multiple hooks files * cr * 🐛 Handle missing ref errors * 🔥 Remove outdated `continue` * 🎨 Change one-liners to blocks * 📦 Update `package-lock.json` Co-authored-by: Ahsan Virani <[email protected]>
1 parent 2b4f5c6 commit 43e054f

37 files changed

+676
-217
lines changed

package-lock.json

+87-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/config/schema.ts

+27
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,13 @@ export const schema = {
681681
},
682682
},
683683

684+
externalFrontendHooksUrls: {
685+
doc: 'URLs to external frontend hooks files, ; separated',
686+
format: String,
687+
default: 'https://public-stage.n8n.cloud/posthog-hooks.js',
688+
env: 'EXTERNAL_FRONTEND_HOOKS_URLS',
689+
},
690+
684691
externalHookFiles: {
685692
doc: 'Files containing external hooks. Multiple files can be separated by colon (":")',
686693
format: String,
@@ -888,6 +895,26 @@ export const schema = {
888895
env: 'N8N_DIAGNOSTICS_ENABLED',
889896
},
890897
config: {
898+
posthog: {
899+
apiKey: {
900+
doc: 'API key for PostHog',
901+
format: String,
902+
default: 'phc_4URIAm1uYfJO7j8kWSe0J8lc8IqnstRLS7Jx8NcakHo',
903+
env: 'N8N_DIAGNOSTICS_POSTHOG_API_KEY',
904+
},
905+
apiHost: {
906+
doc: 'API host for PostHog',
907+
format: String,
908+
default: 'https://app.posthog.com',
909+
env: 'N8N_DIAGNOSTICS_POSTHOG_API_HOST',
910+
},
911+
disableSessionRecording: {
912+
doc: 'Disable posthog session recording',
913+
format: Boolean,
914+
default: true,
915+
env: 'N8N_DIAGNOSTICS_POSTHOG_DISABLE_RECORDING',
916+
},
917+
},
891918
frontend: {
892919
doc: 'Diagnostics config for frontend.',
893920
format: String,

packages/cli/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
"passport-cookie": "^1.0.9",
158158
"passport-jwt": "^4.0.0",
159159
"pg": "^8.3.0",
160+
"posthog-node": "^1.3.0",
160161
"prom-client": "^13.1.0",
161162
"psl": "^1.8.0",
162163
"shelljs": "^0.8.5",

packages/cli/src/Interfaces.ts

+3
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ export interface IN8nUISettings {
516516
missingPackages?: boolean;
517517
executionMode: 'regular' | 'queue';
518518
communityNodesEnabled: boolean;
519+
deployment: {
520+
type: string;
521+
};
519522
isNpmAvailable: boolean;
520523
}
521524

0 commit comments

Comments
 (0)