[resumes][feat] track some ga events

pull/455/head
Keane Chan 2 years ago
parent 0f40848a70
commit 45d147567d
No known key found for this signature in database
GPG Key ID: 32718398E1E9F87C

@ -17,6 +17,7 @@ import {
} from '@heroicons/react/20/solid';
import { Button, Spinner } from '@tih/ui';
import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics';
import ResumeCommentsForm from '~/components/resumes/comments/ResumeCommentsForm';
import ResumeCommentsList from '~/components/resumes/comments/ResumeCommentsList';
import ResumePdf from '~/components/resumes/ResumePdf';
@ -48,6 +49,8 @@ export default function ResumeReviewPage() {
const router = useRouter();
const { resumeId } = router.query;
const utils = trpc.useContext();
const { event: gaEvent } = useGoogleAnalytics();
// Safe to assert resumeId type as string because query is only sent if so
const detailsQuery = trpc.useQuery(
['resumes.resume.findOne', { resumeId: resumeId as string }],
@ -58,16 +61,31 @@ export default function ResumeReviewPage() {
const starMutation = trpc.useMutation('resumes.resume.star', {
onSuccess() {
invalidateResumeQueries();
gaEvent({
action: 'resumes.star_button_click',
category: 'engagement',
label: 'Star Resume',
});
},
});
const unstarMutation = trpc.useMutation('resumes.resume.unstar', {
onSuccess() {
invalidateResumeQueries();
gaEvent({
action: 'resumes.star_button_click',
category: 'engagement',
label: 'Unstar Resume',
});
},
});
const resolveMutation = trpc.useMutation('resumes.resume.user.resolve', {
onSuccess() {
invalidateResumeQueries();
gaEvent({
action: 'resumes.resolve_button_click',
category: 'engagement',
label: 'Resolve Resume',
});
},
});

@ -19,6 +19,7 @@ import {
TextInput,
} from '@tih/ui';
import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics';
import SubmissionGuidelines from '~/components/resumes/submit-form/SubmissionGuidelines';
import { RESUME_STORAGE_KEY } from '~/constants/file-storage-keys';
@ -74,6 +75,8 @@ export default function SubmitResumeForm({
const router = useRouter();
const trpcContext = trpc.useContext();
const resumeUpsertMutation = trpc.useMutation('resumes.resume.user.upsert');
const { event: gaEvent } = useGoogleAnalytics();
const isNewForm = initFormDetails == null;
const {
@ -172,6 +175,11 @@ export default function SubmitResumeForm({
'resumes.resume.getTotalFilterCounts',
);
router.push('/resumes');
gaEvent({
action: 'resumes.submit_button_click',
category: 'engagement',
label: 'Submit Resume',
});
} else {
onClose();
}

Loading…
Cancel
Save