mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-16 21:06:35 +08:00
feat: add sign out ga event (#57150)
This commit is contained in:
parent
653629f8db
commit
67a9657cf0
@ -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) {
|
||||
|
||||
@ -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`);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user