feat: add sign out ga event (#57150)

This commit is contained in:
Ahmad Abdolsaheb 2024-11-16 20:28:29 +03:00 committed by GitHub
parent 653629f8db
commit 67a9657cf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -83,6 +83,11 @@ interface SignIn {
event: 'sign_in';
}
interface SignOut {
event: 'sign_out';
user_id: undefined;
}
export type GAevent =
| DonationViewEvent
| DonationEvent
@ -92,6 +97,7 @@ export type GAevent =
| ExperimentViewEvent
| ChallengeFailedEvent
| UserData
| SignOut
| SignIn;
export default function callGA(payload: GAevent) {

View File

@ -8,6 +8,7 @@ import { Button, Modal, Spacer } from '@freecodecamp/ui';
import { hardGoTo as navigate, closeSignoutModal } from '../../redux/actions';
import { isSignoutModalOpenSelector } from '../../redux/selectors';
import { apiLocation } from '../../../config/env.json';
import callGA from '../../analytics/call-ga';
const mapStateToProps = createSelector(
isSignoutModalOpenSelector,
@ -41,6 +42,7 @@ function SignoutModal(props: SignoutModalProps): JSX.Element {
const handleSignout = () => {
closeSignoutModal();
callGA({ event: 'sign_out', user_id: undefined });
navigate(`${apiLocation}/signout`);
};