add PostHog analytics tracking alongside Amplitude#1591
Conversation
Create PosthogService following official Angular guide with ngZone.runOutsideAngular initialization. Add posthog.capture() calls alongside all existing Angulartics2 eventTrack.next() calls and template directives. PostHog only initializes in production SaaS environment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| if (dynamicColumn && this.savedFilterMap[this.selectedFilterSetId]) { | ||
| const filters = params.filters ? JsonURL.parse(params.filters) : {}; | ||
|
|
||
| this.savedFilterMap[this.selectedFilterSetId].dynamicColumn = { |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
In general, to fix prototype-polluting assignments from untrusted keys, either (1) use a data structure that is not vulnerable to special keys like __proto__ (e.g., Map or an object created with Object.create(null)), or (2) validate and reject dangerous key values (e.g., __proto__, constructor, prototype) before using them as property names.
The minimal change that preserves existing behavior is to sanitize selectedFilterSetId so it cannot be one of the dangerous keys before it is used to index savedFilterMap. We can do this by introducing a small helper method inside SavedFiltersPanelComponent that checks a string key and returns null or a safe fallback if it matches __proto__, constructor, or prototype. Then we replace direct usage of this.selectedFilterSetId as an index with a sanitized version. In this snippet, the critical use is around lines 224–232; we will compute const safeFilterSetId = this.getSafeFilterSetId();, check it for truthiness, and then use safeFilterSetId when indexing savedFilterMap. This avoids any access to savedFilterMap.__proto__ even if a malicious value is injected via URL parameters, while leaving overall logic (using the selected filter ID if valid) intact.
Concretely:
- Add a private method
isDangerousKey(key: string | null): booleanor directlygetSafeFilterSetId()to the component class, just below existing fields or methods, that checks for__proto__,constructor, andprototype. - In the block starting at line 224, introduce
const safeFilterSetId = this.getSafeFilterSetId();(or equivalent) and replace checks/uses ofthis.selectedFilterSetIdin that block withsafeFilterSetId. - Ensure no new imports are needed; this is pure TypeScript/JavaScript logic.
| @@ -73,6 +73,23 @@ | ||
| public currentFilterForMenu: any = null; | ||
|
|
||
| public tableStructure: any = null; | ||
|
|
||
| /** | ||
| * Returns the currently selected filter set ID only if it is safe to use | ||
| * as an object key (that is, it does not conflict with Object.prototype). | ||
| */ | ||
| private getSafeFilterSetId(): string | null { | ||
| const key = this.selectedFilterSetId; | ||
| if (!key) { | ||
| return null; | ||
| } | ||
|
|
||
| if (key === '__proto__' || key === 'constructor' || key === 'prototype') { | ||
| return null; | ||
| } | ||
|
|
||
| return key; | ||
| } | ||
| public tableRowFieldsShown: { [key: string]: any } = {}; | ||
| public tableRowStructure: { [key: string]: any } = {}; | ||
| public tableWidgetsList: string[] = []; | ||
| @@ -221,11 +238,12 @@ | ||
| const params = this.route.snapshot.queryParams; | ||
| const dynamicColumn = params.dynamic_column ? JsonURL.parse(params.dynamic_column) : null; | ||
|
|
||
| if (this.selectedFilterSetId && this.savedFilterData.length > 0) { | ||
| if (dynamicColumn && this.savedFilterMap[this.selectedFilterSetId]) { | ||
| const safeFilterSetId = this.getSafeFilterSetId(); | ||
| if (safeFilterSetId && this.savedFilterData.length > 0) { | ||
| if (dynamicColumn && this.savedFilterMap[safeFilterSetId]) { | ||
| const filters = params.filters ? JsonURL.parse(params.filters) : {}; | ||
|
|
||
| this.savedFilterMap[this.selectedFilterSetId].dynamicColumn = { | ||
| this.savedFilterMap[safeFilterSetId].dynamicColumn = { | ||
| column: dynamicColumn.column_name, | ||
| operator: dynamicColumn.comparator, | ||
| value: filters[dynamicColumn.column_name]?.[dynamicColumn.comparator] || null, |
There was a problem hiding this comment.
Pull request overview
Adds PostHog analytics tracking alongside the existing Angulartics2/Amplitude instrumentation, moving PostHog initialization out of main.ts into an Angular service and adding posthog.capture() calls across many user actions.
Changes:
- Added
PosthogServiceand shifted PostHog initialization to Angular (intended to run only for production SaaS). - Added
posthog.capture()calls alongside existingangulartics2.eventTrack.next()calls in TS and alongside existingangulartics*template directives in HTML. - Exposed
posthogon multiple components for template usage (protected posthog = posthog) and added PostHog tracking to additional flows (dashboards, filters, secrets, auth, company, connections, etc.).
Reviewed changes
Copilot reviewed 99 out of 99 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/main.ts | Removes direct PostHog initialization from app bootstrap. |
| frontend/src/app/services/tables.service.ts | Adds PostHog capture for several dashboard/AI-related events in service-layer flows. |
| frontend/src/app/services/posthog.service.ts | Introduces an Angular service responsible for PostHog initialization. |
| frontend/src/app/components/users/users.component.ts | Exposes posthog for template capture usage in Users UI. |
| frontend/src/app/components/users/users.component.html | Adds PostHog capture calls to users/groups UI interactions. |
| frontend/src/app/components/users/user-add-dialog/user-add-dialog.component.ts | Adds PostHog capture on successful add-user-to-group action. |
| frontend/src/app/components/users/permissions-add-dialog/permissions-add-dialog.component.ts | Adds PostHog capture on permission update success. |
| frontend/src/app/components/users/group-delete-dialog/group-delete-dialog.component.ts | Adds PostHog capture on group deletion success. |
| frontend/src/app/components/users/group-add-dialog/group-add-dialog.component.ts | Adds PostHog capture on group creation success. |
| frontend/src/app/components/user-settings/user-settings.component.ts | Adds PostHog capture to multiple account-settings actions and exposes posthog for template usage. |
| frontend/src/app/components/user-settings/user-settings.component.html | Adds PostHog capture to user-settings form interactions. |
| frontend/src/app/components/user-settings/enable-two-fa-dialog/enable-two-fa-dialog.component.ts | Adds PostHog capture on 2FA enable success. |
| frontend/src/app/components/user-settings/account-delete-confirmation/account-delete-confirmation.component.ts | Adds PostHog capture for account deletion event (including properties). |
| frontend/src/app/components/ui-components/user-password/user-password.component.ts | Exposes posthog for template capture usage in password component. |
| frontend/src/app/components/ui-components/user-password/user-password.component.html | Adds PostHog capture to registration password-change interaction. |
| frontend/src/app/components/secrets/secrets.component.ts | Adds PostHog capture for secrets list dialog opens. |
| frontend/src/app/components/secrets/edit-secret-dialog/edit-secret-dialog.component.ts | Adds PostHog capture on secret update success. |
| frontend/src/app/components/secrets/delete-secret-dialog/delete-secret-dialog.component.ts | Adds PostHog capture on secret delete success. |
| frontend/src/app/components/secrets/create-secret-dialog/create-secret-dialog.component.ts | Adds PostHog capture on secret creation success. |
| frontend/src/app/components/registration/registration.component.ts | Adds PostHog capture to registration lifecycle events and exposes posthog for templates. |
| frontend/src/app/components/registration/registration.component.html | Adds PostHog capture to registration form interactions and social sign-up clicks. |
| frontend/src/app/components/password-change/password-change.component.ts | Adds PostHog capture on manual password change success. |
| frontend/src/app/components/login/login.component.ts | Adds PostHog capture to login lifecycle events and exposes posthog for templates. |
| frontend/src/app/components/login/login.component.html | Adds PostHog capture to login form interactions and auth button clicks. |
| frontend/src/app/components/dashboards/widget-edit-dialog/widget-edit-dialog.component.ts | Adds PostHog capture on widget create/update success. |
| frontend/src/app/components/dashboards/widget-delete-dialog/widget-delete-dialog.component.ts | Adds PostHog capture on widget delete success. |
| frontend/src/app/components/dashboards/dashboards-list/dashboards-list.component.ts | Adds PostHog capture for dashboard navigation and dialog opens. |
| frontend/src/app/components/dashboards/dashboard-view/dashboard-view.component.ts | Adds PostHog capture for edit mode changes and widget dialog opens. |
| frontend/src/app/components/dashboards/dashboard-edit-dialog/dashboard-edit-dialog.component.ts | Adds PostHog capture on dashboard create/update success. |
| frontend/src/app/components/dashboards/dashboard-delete-dialog/dashboard-delete-dialog.component.ts | Adds PostHog capture on dashboard delete success. |
| frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.html | Adds PostHog capture to saved-filters UI actions. |
| frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.ts | Adds PostHog capture for widgets update success and exposes posthog for templates. |
| frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.html | Adds PostHog capture to widget add actions. |
| frontend/src/app/components/dashboard/db-table-view/db-table-view.component.ts | Exposes posthog for template capture usage in table view. |
| frontend/src/app/components/dashboard/db-table-view/db-table-view.component.html | Adds PostHog capture across many table-view actions (search, AI, add/edit/delete row, menus). |
| frontend/src/app/components/dashboard/db-table-view/db-table-import-dialog/db-table-import-dialog.component.ts | Adds PostHog capture on import success. |
| frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.ts | Exposes posthog for template capture usage in filters dialog. |
| frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.html | Adds PostHog capture to filters dialog actions. |
| frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.ts | Adds PostHog capture on export success. |
| frontend/src/app/components/dashboard/db-table-view/db-table-actions/db-table-actions.component.html | Adds PostHog capture to automations “add rule” actions. |
| frontend/src/app/components/dashboard/dashboard.component.ts | Adds PostHog capture for filter application and exposes posthog for templates. |
| frontend/src/app/components/dashboard/dashboard.component.html | Adds PostHog capture to sidebar toggle actions. |
| frontend/src/app/components/connections-list/own-connections/own-connections.component.ts | Exposes posthog for template capture usage in own connections list. |
| frontend/src/app/components/connections-list/own-connections/own-connections.component.html | Adds PostHog capture to open/add connection clicks. |
| frontend/src/app/components/connections-list/demo-connections/demo-connections.component.ts | Exposes posthog for template capture usage in demo connections list. |
| frontend/src/app/components/connections-list/demo-connections/demo-connections.component.html | Adds PostHog capture to demo connection open clicks. |
| frontend/src/app/components/connection-settings/connection-settings.component.ts | Adds PostHog capture for settings create/update/reset and exposes posthog for templates. |
| frontend/src/app/components/connection-settings/connection-settings.component.html | Adds PostHog capture to connection-settings form interactions. |
| frontend/src/app/components/connect-db/master-encryption-password/master-encryption-password.component.ts | Exposes posthog for template capture usage in encryption toggle UI. |
| frontend/src/app/components/connect-db/master-encryption-password/master-encryption-password.component.html | Adds PostHog capture to encryption toggle click. |
| frontend/src/app/components/connect-db/db-credentials-forms/redis-credentials-form/redis-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/redis-credentials-form/redis-credentials-form.component.html | Adds PostHog capture to Redis credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/postgres-credentials-form/postgres-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/postgres-credentials-form/postgres-credentials-form.component.html | Adds PostHog capture to Postgres credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/oracledb-credentials-form/oracledb-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/oracledb-credentials-form/oracledb-credentials-form.component.html | Adds PostHog capture to Oracle credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/mysql-credentials-form/mysql-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/mysql-credentials-form/mysql-credentials-form.component.html | Adds PostHog capture to MySQL credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/mssql-credentials-form/mssql-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/mssql-credentials-form/mssql-credentials-form.component.html | Adds PostHog capture to MSSQL credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/mongodb-credentials-form/mongodb-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/mongodb-credentials-form/mongodb-credentials-form.component.html | Adds PostHog capture to MongoDB credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.html | Adds PostHog capture to Elastic credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/dynamodb-credentials-form/dynamodb-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/dynamodb-credentials-form/dynamodb-credentials-form.component.html | Adds PostHog capture to DynamoDB credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/db2-credentials-form/db2-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/db2-credentials-form/db2-credentials-form.component.html | Adds PostHog capture to DB2 credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/clickhouse-credentials-form/clickhouse-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/clickhouse-credentials-form/clickhouse-credentials-form.component.html | Adds PostHog capture to ClickHouse credential form field interactions. |
| frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.ts | Exposes posthog for template capture usage in credential form. |
| frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.html | Adds PostHog capture to Cassandra credential form field interactions. |
| frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.ts | Adds PostHog capture for connection deletion (including properties). |
| frontend/src/app/components/connect-db/connect-db.component.html | Adds PostHog capture for Connect DB form interactions and actions. |
| frontend/src/app/components/company/revoke-invitation-dialog/revoke-invitation-dialog.component.ts | Adds PostHog capture on invitation revoke success. |
| frontend/src/app/components/company/invite-member-dialog/invite-member-dialog.component.ts | Adds PostHog capture on member invite success and exposes posthog for template usage. |
| frontend/src/app/components/company/invite-member-dialog/invite-member-dialog.component.html | Adds PostHog capture to role-menu click. |
| frontend/src/app/components/company/delete-member-dialog/delete-member-dialog.component.ts | Adds PostHog capture on member delete success. |
| frontend/src/app/components/company/delete-domain-dialog/delete-domain-dialog.component.ts | Adds PostHog capture on domain delete success. |
| frontend/src/app/components/company/company.component.html | Adds PostHog capture across company settings interactions. |
| frontend/src/app/components/company-member-invitation/company-member-invitation.component.ts | Adds PostHog capture on invitation accept success. |
| frontend/src/app/components/charts/charts-list/charts-list.component.ts | Adds PostHog capture for charts page events. |
| frontend/src/app/components/charts/chart-edit/chart-edit.component.ts | Adds PostHog capture for test query and save events. |
| frontend/src/app/components/charts/chart-delete-dialog/chart-delete-dialog.component.ts | Adds PostHog capture on delete success. |
| frontend/src/app/components/branding/branding.component.html | Adds PostHog capture to branding form interactions. |
| frontend/src/app/components/audit/audit.component.ts | Exposes posthog for template capture usage in audit. |
| frontend/src/app/components/audit/audit.component.html | Adds PostHog capture to audit filters and details action. |
| frontend/src/app/components/api-keys/api-keys.component.ts | Adds PostHog capture on API key create/delete success and exposes posthog for templates. |
| frontend/src/app/components/api-keys/api-keys.component.html | Adds PostHog capture to API key title input change. |
| frontend/src/app/app.component.ts | Injects PosthogService to trigger initialization and adds PostHog capture for demo login. |
| frontend/src/app/app.component.html | Adds PostHog capture to demo navbar CTA click. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| reason: this.reason, | ||
| message: this.message, |
There was a problem hiding this comment.
This posthog.capture call includes reason and message fields provided by the user. These can contain sensitive or identifying information and may be inappropriate to send to analytics. Consider omitting/redacting these fields (or replacing with a bounded enum) before sending.
| reason: this.reason, | |
| message: this.message, | |
| hasReason: !!this.reason, | |
| hasMessage: !!this.message, |
| this.ngZone.runOutsideAngular(() => { | ||
| posthog.init('phc_VPnWHIMj9UjhRLPr7shATjgL0J4KrWWOHkK3JwZbnkw', { | ||
| api_host: 'https://us.i.posthog.com', | ||
| defaults: '2025-11-30', | ||
| }); |
There was a problem hiding this comment.
posthog.init is being called with a defaults: '2025-11-30' option. This does not appear to be a valid posthog-js init config field and may either fail type-checking/build or be silently ignored at runtime. Please remove it or replace it with the intended PostHog configuration option(s).
| constructor( | ||
| private ngZone: NgZone, | ||
| private router: Router, | ||
| private destroyRef: DestroyRef, | ||
| ) { | ||
| if ((environment as any).saas && environment.production) { | ||
| this.initPostHog(); | ||
| } |
There was a problem hiding this comment.
PostHog is initialized conditionally in PosthogService, but posthog-js is imported and posthog.capture() is called directly across many components/templates. This can increase bundle size for non-SaaS/non-production builds and may cause captures to run before init (or when init never happens). Consider centralizing tracking behind PosthogService (e.g., a capture() wrapper that no-ops unless enabled) and optionally lazy-load posthog-js only when (environment as any).saas && environment.production is true.
| posthog.capture('Delete account', { | ||
| email: this.data.email, | ||
| reason: this.data.reason, | ||
| message: this.data.message, | ||
| }); |
There was a problem hiding this comment.
This posthog.capture call sends email/reason/message content to analytics. If any of these fields can contain PII or sensitive free-form text, this can create a data-exposure/privacy issue. Consider removing these properties, redacting/hashing them, or gating them behind an explicit consent/allowlist.
| if (this.db.connectionType === 'agent' || credsCorrect.result) { | ||
| this.updateConnectionRequest(); | ||
| } else { | ||
| this.handleConnectionError(credsCorrect.message); |
There was a problem hiding this comment.
The base expression of this property access is always undefined.
| if (this.db.connectionType === 'agent' || credsCorrect.result) { | |
| this.updateConnectionRequest(); | |
| } else { | |
| this.handleConnectionError(credsCorrect.message); | |
| const isAgentConnection = this.db.connectionType === 'agent'; | |
| const connectionTestPassed = !!credsCorrect && !!credsCorrect.result; | |
| if (isAgentConnection || connectionTestPassed) { | |
| this.updateConnectionRequest(); | |
| } else { | |
| const errorMessage = credsCorrect?.message ?? 'Connection test failed'; | |
| this.handleConnectionError(errorMessage); |
| this.angulartics2.eventTrack.next({ | ||
| action: `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | ||
| properties: { | ||
| connectionType: this.db.connectionType, | ||
| dbType: this.db.type, | ||
| errorMessage: credsCorrect.message, | ||
| }, | ||
| }); | ||
| posthog.capture( | ||
| `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | ||
| { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: credsCorrect.message }, | ||
| ); | ||
|
|
||
| if (credsCorrect?.result) { | ||
| this.createConnectionRequest(); | ||
| } else { | ||
| this.handleConnectionError(credsCorrect.message); |
There was a problem hiding this comment.
The base expression of this property access is always null.
| this.angulartics2.eventTrack.next({ | |
| action: `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | |
| properties: { | |
| connectionType: this.db.connectionType, | |
| dbType: this.db.type, | |
| errorMessage: credsCorrect.message, | |
| }, | |
| }); | |
| posthog.capture( | |
| `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | |
| { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: credsCorrect.message }, | |
| ); | |
| if (credsCorrect?.result) { | |
| this.createConnectionRequest(); | |
| } else { | |
| this.handleConnectionError(credsCorrect.message); | |
| const connectionResult = !!credsCorrect?.result; | |
| const errorMessage = credsCorrect?.message ?? ''; | |
| this.angulartics2.eventTrack.next({ | |
| action: `Connect DB: automatic test connection on add is ${connectionResult ? 'passed' : 'failed'}`, | |
| properties: { | |
| connectionType: this.db.connectionType, | |
| dbType: this.db.type, | |
| errorMessage: errorMessage, | |
| }, | |
| }); | |
| posthog.capture( | |
| `Connect DB: automatic test connection on add is ${connectionResult ? 'passed' : 'failed'}`, | |
| { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: errorMessage }, | |
| ); | |
| if (connectionResult) { | |
| this.createConnectionRequest(); | |
| } else { | |
| this.handleConnectionError(errorMessage); |
| }, | ||
| }); | ||
| posthog.capture( | ||
| `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, |
There was a problem hiding this comment.
The base expression of this property access is always null.
| action: `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | ||
| properties: { | ||
| connectionType: this.db.connectionType, | ||
| dbType: this.db.type, | ||
| errorMessage: credsCorrect.message, | ||
| }, | ||
| }); | ||
| posthog.capture( | ||
| `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | ||
| { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: credsCorrect.message }, | ||
| ); | ||
|
|
||
| if (credsCorrect?.result) { | ||
| this.createConnectionRequest(); | ||
| } else { | ||
| this.handleConnectionError(credsCorrect.message); |
There was a problem hiding this comment.
The base expression of this property access is always null.
| action: `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | |
| properties: { | |
| connectionType: this.db.connectionType, | |
| dbType: this.db.type, | |
| errorMessage: credsCorrect.message, | |
| }, | |
| }); | |
| posthog.capture( | |
| `Connect DB: automatic test connection on add is ${credsCorrect.result ? 'passed' : 'failed'}`, | |
| { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: credsCorrect.message }, | |
| ); | |
| if (credsCorrect?.result) { | |
| this.createConnectionRequest(); | |
| } else { | |
| this.handleConnectionError(credsCorrect.message); | |
| action: `Connect DB: automatic test connection on add is ${credsCorrect?.result ? 'passed' : 'failed'}`, | |
| properties: { | |
| connectionType: this.db.connectionType, | |
| dbType: this.db.type, | |
| errorMessage: credsCorrect?.message, | |
| }, | |
| }); | |
| posthog.capture( | |
| `Connect DB: automatic test connection on add is ${credsCorrect?.result ? 'passed' : 'failed'}`, | |
| { connectionType: this.db.connectionType, dbType: this.db.type, errorMessage: credsCorrect?.message }, | |
| ); | |
| if (credsCorrect?.result) { | |
| this.createConnectionRequest(); | |
| } else { | |
| this.handleConnectionError(credsCorrect?.message); |
| if (credsCorrect?.result) { | ||
| this.createConnectionRequest(); | ||
| } else { | ||
| this.handleConnectionError(credsCorrect.message); |
There was a problem hiding this comment.
The base expression of this property access is always null.
| this.handleConnectionError(credsCorrect.message); | |
| this.handleConnectionError(credsCorrect?.message ?? ''); |
| provider = 'google'; | ||
| return; |
There was a problem hiding this comment.
The value assigned to provider here is unused.
| provider = 'google'; | |
| return; | |
| return 'google'; |
Create PosthogService following official Angular guide with ngZone.runOutsideAngular initialization. Add posthog.capture() calls alongside all existing Angulartics2 eventTrack.next() calls and template directives. PostHog only initializes in production SaaS environment.