From cb47e2bec6276cf8239fa69f63194a03e0c14621 Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 19 Mar 2023 21:04:18 +0000 Subject: [PATCH] Fix GA for first page view (#5769) --- src/pages/_app.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index edd3f5ed..71737596 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -15,6 +15,7 @@ import '../styles/sandpack.css'; if (typeof window !== 'undefined') { if (process.env.NODE_ENV === 'production') { ga('create', process.env.NEXT_PUBLIC_GA_TRACKING_ID, 'auto'); + ga('send', 'pageview'); } const terminationEvent = 'onpagehide' in window ? 'pagehide' : 'unload'; window.addEventListener(terminationEvent, function () {