From 4854604e8e6c6acfd76e193987858e1dc1c40c7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Fernando=20H=C3=B6wer=20Barbosa?=
Date: Fri, 9 Dec 2022 17:10:19 +0100
Subject: [PATCH 01/13] Remove unnecesary file
---
.../with-google-analytics/pages/_document.js | 25 -------------------
1 file changed, 25 deletions(-)
delete mode 100644 examples/with-google-analytics/pages/_document.js
diff --git a/examples/with-google-analytics/pages/_document.js b/examples/with-google-analytics/pages/_document.js
deleted file mode 100644
index db3c34b900d5..000000000000
--- a/examples/with-google-analytics/pages/_document.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { Html, Head, Main, NextScript } from 'next/document'
-
-export default function Document() {
- return (
-
-
-
-
-
-
- {/* Global Site Tag (gtag.js) - Google Analytics */}
-
-
-
- )
-}
From bc4f914ac99c3c4e23197a23ecac012b723429f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Fernando=20H=C3=B6wer=20Barbosa?=
Date: Fri, 9 Dec 2022 17:39:30 +0100
Subject: [PATCH 02/13] Remove unnecesary code for the example
---
examples/with-google-analytics/lib/gtag.js | 9 ---------
examples/with-google-analytics/pages/_app.js | 9 ++++-----
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/examples/with-google-analytics/lib/gtag.js b/examples/with-google-analytics/lib/gtag.js
index 49507f8b959f..56a0c542f9ef 100644
--- a/examples/with-google-analytics/lib/gtag.js
+++ b/examples/with-google-analytics/lib/gtag.js
@@ -6,12 +6,3 @@ export const pageview = (url) => {
page_path: url,
})
}
-
-// https://developers.google.com/analytics/devguides/collection/gtagjs/events
-export const event = ({ action, category, label, value }) => {
- window.gtag('event', action, {
- event_category: category,
- event_label: label,
- value: value,
- })
-}
diff --git a/examples/with-google-analytics/pages/_app.js b/examples/with-google-analytics/pages/_app.js
index 7c37a3b61de2..ee5b88ed20de 100644
--- a/examples/with-google-analytics/pages/_app.js
+++ b/examples/with-google-analytics/pages/_app.js
@@ -1,7 +1,7 @@
-import { useEffect } from 'react'
-import Script from 'next/script'
-import { useRouter } from 'next/router'
-import * as gtag from '../lib/gtag'
+import { useRouter } from 'next/router';
+import Script from 'next/script';
+import { useEffect } from 'react';
+import * as gtag from '../lib/gtag';
const App = ({ Component, pageProps }) => {
const router = useRouter()
@@ -25,7 +25,6 @@ const App = ({ Component, pageProps }) => {
src={`https://www.googletagmanager.com/gtag/js?id=${gtag.GA_TRACKING_ID}`}
/>