Skip to content

Commit

Permalink
chore: add ga4 page view tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
TuukkaIkius committed Apr 30, 2024
1 parent 827dd42 commit caefed2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const lato = localLato({

import "styles/varaibles.css";
import "styles/global.css";
import { TrackingEvent } from "utils/tracking";

const NEXT_PUBLIC_GTM_ID = process.env.NEXT_PUBLIC_GTM_ID;
const NEXT_PUBLIC_GTAG_ID = process.env.NEXT_PUBLIC_GTAG_ID;
Expand Down Expand Up @@ -211,11 +212,14 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
if (!isEngaged) return;
// Trigger engagement view events here
sendEngagedView();
TrackingEvent("session_threshold", {
session_threshold_reached: 30,
});
}, [isEngaged]);

const Pageviews = () => {
// Trigger page views here

TrackingEvent("page_view");
// Qualified page view
if (!!window["qualified"]) window["qualified"]("page");
// Posthog page view
Expand Down

0 comments on commit caefed2

Please sign in to comment.