From 0f5e8354a58d77837d23d5c94f95bdab9bc86559 Mon Sep 17 00:00:00 2001 From: "Vitor A. Batista" Date: Thu, 14 Mar 2024 13:19:51 -0300 Subject: [PATCH] fix page view issue --- src/pages/details-page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/details-page.tsx b/src/pages/details-page.tsx index d9b2aeb..1a6c5f7 100644 --- a/src/pages/details-page.tsx +++ b/src/pages/details-page.tsx @@ -21,6 +21,7 @@ export default function DetailsPage() { const { postId } = useParams(); const navigate = useNavigate(); + ReactGA.send({ hitType: "pageview", page: postId, title: post.title }); useEffect(() => { const getPostById = async () => { @@ -28,7 +29,6 @@ export default function DetailsPage() { await axios.get(process.env.REACT_APP_API_PATH + `/api/posts/${postId}`).then((response) => { setIsLoading(false); setPost(response.data); - ReactGA.send({ hitType: "pageview", page: postId, title: response.data.title }); }); } catch (error) {