Skip to content

Commit

Permalink
Fix ga
Browse files Browse the repository at this point in the history
  • Loading branch information
sayshark75 committed Apr 4, 2024
1 parent 5907e60 commit 5ae1a49
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 5 additions & 0 deletions src/components/AboutPage/ResumeButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Button, Flex } from "@chakra-ui/react";
import { ScalePing } from "../../animations/ScaleAnimations";
import { resumeDownload, resumelink } from "../../sources/Links";
import ReactGA from "react-ga4";

const ResumeButton = () => {
const handleResumeDownload = () => {
ReactGA.event({
category: "Resume",
action: "Downloaded the Resume",
});
window.open(resumelink, "_blank");
};
return (
Expand Down
6 changes: 0 additions & 6 deletions src/pages/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Flex } from "@chakra-ui/react";
import { ScrollContext } from "../../contexts/ScrollContext";
import MdHeading from "../../components/Headings/MdHeading";
import AboutCard from "../../components/AboutPage/AboutCard";
import ReactGA from "react-ga4";

const About = () => {
const context = useContext(ScrollContext);
Expand All @@ -13,11 +12,6 @@ const About = () => {
}
const { AboutRef } = context;

ReactGA.event({
category: "pagevisit",
action: `Viewed About Page`,
});

return (
<>
<Flex
Expand Down
11 changes: 5 additions & 6 deletions src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Flex, useDisclosure } from "@chakra-ui/react";
import { useContext } from "react";
import { useContext, useEffect } from "react";
import { ScrollContext } from "../../contexts/ScrollContext";
import EmailModal from "../../components/EmailModal/EmailModal";
import IconButtonComp from "../../components/HomePage/IconButtonComp";
Expand All @@ -13,6 +13,10 @@ const Home = () => {
const scrollContext = useContext(ScrollContext);
const { isOpen, onOpen, onClose } = useDisclosure();

useEffect(() => {
ReactGA.send({ hitType: "pageview", page: "/", title: "Visited Portfolio" });
}, []);

if (!scrollContext) {
return;
}
Expand All @@ -21,11 +25,6 @@ const Home = () => {

const SocialButtonsData = socialBtnDataCreator(onOpen);

ReactGA.event({
category: "pagevisit",
action: `Viewed Home Page`,
});

return (
<>
<Flex
Expand Down
4 changes: 4 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/// <reference types="vite/client" />

interface ImportMeta {
readonly env: Record<string, string>;
}

0 comments on commit 5ae1a49

Please sign in to comment.