Skip to content

Commit

Permalink
feat(editor, core): Integrate PostHog (#3865)
Browse files Browse the repository at this point in the history
* 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 <ahsan.virani@gmail.com>
  • Loading branch information
ivov and ahsanv authored Aug 19, 2022
1 parent 2b4f5c6 commit 43e054f
Show file tree
Hide file tree
Showing 37 changed files with 676 additions and 217 deletions.
118 changes: 87 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions packages/cli/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,13 @@ export const schema = {
},
},

externalFrontendHooksUrls: {
doc: 'URLs to external frontend hooks files, ; separated',
format: String,
default: 'https://public-stage.n8n.cloud/posthog-hooks.js',
env: 'EXTERNAL_FRONTEND_HOOKS_URLS',
},

externalHookFiles: {
doc: 'Files containing external hooks. Multiple files can be separated by colon (":")',
format: String,
Expand Down Expand Up @@ -888,6 +895,26 @@ export const schema = {
env: 'N8N_DIAGNOSTICS_ENABLED',
},
config: {
posthog: {
apiKey: {
doc: 'API key for PostHog',
format: String,
default: 'phc_4URIAm1uYfJO7j8kWSe0J8lc8IqnstRLS7Jx8NcakHo',
env: 'N8N_DIAGNOSTICS_POSTHOG_API_KEY',
},
apiHost: {
doc: 'API host for PostHog',
format: String,
default: 'https://app.posthog.com',
env: 'N8N_DIAGNOSTICS_POSTHOG_API_HOST',
},
disableSessionRecording: {
doc: 'Disable posthog session recording',
format: Boolean,
default: true,
env: 'N8N_DIAGNOSTICS_POSTHOG_DISABLE_RECORDING',
},
},
frontend: {
doc: 'Diagnostics config for frontend.',
format: String,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"passport-cookie": "^1.0.9",
"passport-jwt": "^4.0.0",
"pg": "^8.3.0",
"posthog-node": "^1.3.0",
"prom-client": "^13.1.0",
"psl": "^1.8.0",
"shelljs": "^0.8.5",
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ export interface IN8nUISettings {
missingPackages?: boolean;
executionMode: 'regular' | 'queue';
communityNodesEnabled: boolean;
deployment: {
type: string;
};
isNpmAvailable: boolean;
}

Expand Down
Loading

0 comments on commit 43e054f

Please sign in to comment.