Browse Source

Fix GA for first page view (#5769)

main
dan 2 years ago
committed by GitHub
parent
commit
cb47e2bec6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/pages/_app.tsx

1
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 () {

Loading…
Cancel
Save