diff --git a/graylog2-web-interface/src/components/authentication/AuthenticatorsEdit/HTTPHeaderAuthConfigSection.tsx b/graylog2-web-interface/src/components/authentication/AuthenticatorsEdit/HTTPHeaderAuthConfigSection.tsx index a13c4b92b32a..823817725a3c 100644 --- a/graylog2-web-interface/src/components/authentication/AuthenticatorsEdit/HTTPHeaderAuthConfigSection.tsx +++ b/graylog2-web-interface/src/components/authentication/AuthenticatorsEdit/HTTPHeaderAuthConfigSection.tsx @@ -26,19 +26,22 @@ import { FormikFormGroup, ErrorAlert, Spinner } from 'components/common'; import SectionComponent from 'components/common/Section/SectionComponent'; import useHistory from 'routing/useHistory'; import type { HTTPHeaderAuthConfigJSON } from 'logic/authentication/HTTPHeaderAuthConfig'; +import { getPathnameWithoutId } from 'util/URLUtils'; import useSendTelemetry from 'logic/telemetry/useSendTelemetry'; +import useLocation from 'routing/useLocation'; +import { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants'; const HTTPHeaderAuthConfigSection = () => { const [submitError, setSubmitError] = useState(); const [loadedConfig, setLoadedConfig] = useState(); const sectionTitle = 'Trusted Header Authentication'; const history = useHistory(); - + const { pathname } = useLocation(); const sendTelemetry = useSendTelemetry(); const _onSubmit = (data: HTTPHeaderAuthConfigJSON) => { - sendTelemetry('form_submit', { - app_pathname: 'authentication', + sendTelemetry(TELEMETRY_EVENT_TYPE.AUTHENTICATION.CONFIG_UPDATED, { + app_pathname: getPathnameWithoutId(pathname), app_section: 'authenticator-trustedheader', app_action_value: 'config-update', }); diff --git a/graylog2-web-interface/src/components/authentication/BackendCreate/ServiceSelect.tsx b/graylog2-web-interface/src/components/authentication/BackendCreate/ServiceSelect.tsx index 1e7b96d02c16..68b399667504 100644 --- a/graylog2-web-interface/src/components/authentication/BackendCreate/ServiceSelect.tsx +++ b/graylog2-web-interface/src/components/authentication/BackendCreate/ServiceSelect.tsx @@ -27,7 +27,10 @@ import { Select, InputDescription } from 'components/common'; import { Button } from 'components/bootstrap'; import type { HistoryFunction } from 'routing/useHistory'; import useHistory from 'routing/useHistory'; +import { getPathnameWithoutId } from 'util/URLUtils'; import useSendTelemetry from 'logic/telemetry/useSendTelemetry'; +import useLocation from 'routing/useLocation'; +import { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants'; const ElementsContainer = styled.div` display: flex; @@ -56,17 +59,18 @@ const BackendCreateSelect = () => { const sortedAuthServices = authServices.sort((s1, s2) => defaultCompare(s1.displayName, s2.displayName)); const authServicesOptions = sortedAuthServices.map((service) => ({ label: service.displayName, value: service.name })); const history = useHistory(); + const { pathname } = useLocation(); const sendTelemetry = useSendTelemetry(); const onSubmit = useCallback((formState: FormState) => { - sendTelemetry('form_submit', { - app_pathname: 'authentication', + sendTelemetry(TELEMETRY_EVENT_TYPE.AUTHENTICATION.SERVICE_CREATED, { + app_pathname: getPathnameWithoutId(pathname), app_section: 'services', app_action_value: 'create-service-form', }); _onSubmit(history, formState); - }, [history, sendTelemetry]); + }, [history, pathname, sendTelemetry]); return ( @@ -80,8 +84,8 @@ const BackendCreateSelect = () => { Operating System