Wizard/Oscap: Add analytics (HMS-5990)

The Intercom team has some ideas about helping new users determine which
security profile is right for them. Tracking differentiates between
"vanilla" OpenSCAP and Compliance so that any messages from Intercom can
be targeted.
This commit is contained in:
Lucas Garfield 2025-04-17 09:55:01 -05:00 committed by Klara Simickova
parent cc649ec7a3
commit 7f585154f2
2 changed files with 17 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import {
Title,
} from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
import OscapOnPremSpinner from './components/OnPremSpinner';
import OscapOnPremWarning from './components/OnPremWarning';
@ -38,16 +39,22 @@ import {
selectComplianceType,
clearKernelAppend,
} from '../../../../store/wizardSlice';
import { useFlag } from '../../../../Utilities/useGetEnvironment';
import {
useFlag,
useGetEnvironment,
} from '../../../../Utilities/useGetEnvironment';
import { useOnPremOpenSCAPAvailable } from '../../../../Utilities/useOnPremOpenSCAP';
const OscapContent = () => {
const dispatch = useAppDispatch();
const { analytics } = useChrome();
const { isFedoraEnv } = useGetEnvironment();
const complianceEnabled = useFlag('image-builder.compliance.enabled');
const complianceType = useAppSelector(selectComplianceType);
const profileID = useAppSelector(selectComplianceProfileID);
const prefetchOscapProfile = useBackendPrefetch('getOscapProfiles', {});
const release = removeBetaFromRelease(useAppSelector(selectDistribution));
const { data: currentProfileData } = useGetOscapCustomizationsQuery(
{
distribution: release,
@ -87,6 +94,14 @@ const OscapContent = () => {
dispatch(clearKernelAppend());
};
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
if (complianceEnabled) {
analytics.screen('ib-createimagewizard-step-security-compliance');
} else {
analytics.screen('ib-createimagewizard-step-security-openscap');
}
}
return (
<Form>
<Title headingLevel="h1" size="xl">

View file

@ -40,6 +40,7 @@ vi.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
analytics: {
track: () => 'test',
group: () => 'test',
screen: () => 'test',
},
isBeta: () => true,
}),