From faadfd6d4a1ceb75cbfa0815f0100ef0330fc367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Wed, 20 Dec 2023 11:41:39 +0100 Subject: [PATCH] refactor(editor): Add telemetry for SSO/SAML (no-changelog) (#8102) https://linear.app/n8n/issue/PAY-1142 --- packages/editor-ui/src/views/SettingsSso.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index 2158bff036..235e3a146c 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -6,6 +6,8 @@ import CopyInput from '@/components/CopyInput.vue'; import { useI18n } from '@/composables/useI18n'; import { useMessage } from '@/composables/useMessage'; import { useToast } from '@/composables/useToast'; +import { useTelemetry } from '@/composables/useTelemetry'; +import { useRootStore } from '@/stores/n8nRoot.store'; const IdentityProviderSettingsType = { URL: 'url', @@ -13,6 +15,8 @@ const IdentityProviderSettingsType = { }; const i18n = useI18n(); +const telemetry = useTelemetry(); +const rootStore = useRootStore(); const ssoStore = useSSOStore(); const uiStore = useUIStore(); const message = useMessage(); @@ -78,6 +82,8 @@ const getSamlConfig = async () => { ssoSettingsSaved.value = !!config?.metadata; }; +let testSucceeded = false; + const onSave = async () => { try { const config = @@ -100,6 +106,13 @@ const onSave = async () => { await onTest(); } } + + telemetry.track('User updated single sign on settings', { + instance_id: rootStore.instanceId, + identity_provider: ipsType.value === 'url' ? 'metadata' : 'xml', + is_valid: testSucceeded, + is_active: ssoStore.isSamlLoginEnabled, + }); } catch (error) { toast.showError(error, i18n.baseText('settings.sso.settings.save.error')); return; @@ -115,8 +128,10 @@ const onTest = async () => { if (typeof window !== 'undefined') { window.open(url, '_blank'); } + testSucceeded = true; } catch (error) { toast.showError(error, 'error'); + testSucceeded = false; } };