Skip to content

Commit

Permalink
UA -> GA4 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
fohte authored Oct 29, 2023
1 parent 3f318ee commit 84e5842
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'

const GA_TRACKING_ID = 'UA-49994513-4'
const GA_TRACKING_ID = 'G-RGKPSR5QL5'

class MyDocument extends Document {
render() {
Expand All @@ -9,7 +9,7 @@ class MyDocument extends Document {
<Head>
<link rel="icon" href="/icon.png" />

{/* Global Site Tag (gtag.js) - Google Analytics */}
{/* Global Tag (gtag.js) */}
<script
async
src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
Expand All @@ -20,9 +20,7 @@ class MyDocument extends Document {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
gtag('config', '${GA_TRACKING_ID}');
`,
}}
/>
Expand Down

0 comments on commit 84e5842

Please sign in to comment.