Skip to content

Commit

Permalink
EPMRPP-96943 || Add GA4 event to track instance invitation settings (#…
Browse files Browse the repository at this point in the history
…4112)

* EPMRPP-96943 || Add GA4 event to track instance invitation settings

* EPMRPP-96943 || Code review fixes - 1
  • Loading branch information
iso9000t authored Nov 29, 2024
1 parent d904d49 commit 8b04324
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@ export const submitAnalyticsBtn = (status) => ({
});

export const ADMIN_SERVER_SETTINGS_PAGE_EVENTS = {
toggleSsoUsers: (switcherValue) => ({
...basicClickEventParametersAdminServerSettingsPage,
element_name: 'sso',
switcher: switcherValue ? 'on' : 'off',
}),
ANALYTICS_TAB: {
...basicClickEventParametersAdminServerSettingsPage,
element_name: 'analytics',
},
// GA3 events
AUTHORIZATION_CONFIGURATION_TAB: {
category: ADMIN_SERVER_SETTINGS_PAGE,
action: 'Click on tab Authorization Configuration',
label: 'Open tab Authorization Configuration',
},
ANALYTICS_TAB: {
...basicClickEventParametersAdminServerSettingsPage,
element_name: 'analytics',
},
ACTIVATE_GITHUB_SWITCHER: {
category: ADMIN_SERVER_SETTINGS_PAGE,
action: 'Click on switcher Activate Github authorization on tab Authorization Configuration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { showSuccessNotification, showErrorNotification } from 'controllers/noti
import formStyles from 'pages/admin/serverSettingsPage/common/formController/formController.scss';
import { fetch } from 'common/utils/fetch';
import { URLS } from 'common/urls';
import { useTracking } from 'react-tracking';
import styles from './ssoUsersForm.scss';

const formCx = classNames.bind(formStyles);
Expand Down Expand Up @@ -65,6 +66,7 @@ export const SsoUsersForm = () => {
const enabledFromStore = useSelector(ssoUsersOnlySelector);
const [enabled, setEnabled] = useState(enabledFromStore);
const inputId = 'ssoUsersToggle';
const { trackEvent } = useTracking();

useEffect(() => {
dispatch(fetchAppInfoAction());
Expand All @@ -79,6 +81,7 @@ export const SsoUsersForm = () => {

const handleToggle = async (value) => {
setEnabled(value);
trackEvent(ADMIN_SERVER_SETTINGS_PAGE_EVENTS.toggleSsoUsers(value));

try {
await fetch(URLS.instanceSettings(), {
Expand Down Expand Up @@ -114,7 +117,6 @@ export const SsoUsersForm = () => {
value={enabled}
onChange={handleToggle}
mobileDisabled
onChangeEventInfo={ADMIN_SERVER_SETTINGS_PAGE_EVENTS.SSO_USERS_SWITCHER}
/>
<div className={cx('description')} aria-live="polite">
{getDescription()}
Expand Down

0 comments on commit 8b04324

Please sign in to comment.