From 0d45335ca7bb24c900b14e19a9f9bde15d6481e8 Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 19 Aug 2024 11:57:19 +0200 Subject: [PATCH 01/12] Add basic Root Layout --- app/layout.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/layout.tsx diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 000000000..2f82be2cf --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,13 @@ +export default function RootLayout({ + // Layouts must accept a children prop. + // This will be populated with nested layouts or pages + children, +}: { + children: React.ReactNode; +}) { + return ( + + {children} + + ); +} From 6e735fd4abd5e122c2939362f0bcff67c90a4c11 Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 19 Aug 2024 11:58:28 +0200 Subject: [PATCH 02/12] Add metadata --- app/layout.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/layout.tsx b/app/layout.tsx index 2f82be2cf..cfbc2313c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,3 +1,9 @@ +import { Metadata } from 'next'; + +export const metadata: Metadata = { + title: 'Bloom', +}; + export default function RootLayout({ // Layouts must accept a children prop. // This will be populated with nested layouts or pages From fb7e1616febdea355f9a928b27bfbc176203439b Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 19 Aug 2024 11:58:51 +0200 Subject: [PATCH 03/12] Add reference included by next --- next-env.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03dc..fd36f9494 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/basic-features/typescript for more information. From 87db13fded15fb7ef18124c914b31e5f0d623db5 Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 19 Aug 2024 12:02:27 +0200 Subject: [PATCH 04/12] Add comment to explain the default meta tags --- app/layout.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/layout.tsx b/app/layout.tsx index cfbc2313c..6d9feae3c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,5 +1,7 @@ import { Metadata } from 'next'; +// Nextjs automatically includes for each route two default meta tags, charset and viewport +// https://nextjs.org/docs/app/building-your-application/optimizing/metadata#default-fields export const metadata: Metadata = { title: 'Bloom', }; From 4017b7e5c9dec5762ea3aa6765cc920fbe709854 Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 19 Aug 2024 12:09:58 +0200 Subject: [PATCH 05/12] Add public testing page to check the migration --- app/public-route-test/page.tsx | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/public-route-test/page.tsx diff --git a/app/public-route-test/page.tsx b/app/public-route-test/page.tsx new file mode 100644 index 000000000..c6f91528d --- /dev/null +++ b/app/public-route-test/page.tsx @@ -0,0 +1,3 @@ +export default async function Page() { + return
PUBLIC TESTING PAGE
; +} From 36f04880453bf57aabf45c9376374a4f389b4b6f Mon Sep 17 00:00:00 2001 From: Alberto Arias Date: Tue, 17 Sep 2024 17:59:11 +0200 Subject: [PATCH 06/12] App router migration google tag manager script (#1117) * Add basic Root Layout * Add metadata * Add reference included by next * Add comment to explain the default meta tags * Add public testing page to check the migration * Remove non required file * Add google tag manager to root layout * Change strategy as worker is experimental and is not including the script * Move gtm to body as next is including it in head properly * Add comment to tackle in the future * Move gtm script from _document to _app --- app/layout.tsx | 10 +++++++++- components/head/GoogleTagManagerScript.tsx | 2 +- pages/_app.tsx | 2 ++ pages/_document.tsx | 2 -- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 6d9feae3c..68b6d6c0b 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,4 +1,5 @@ import { Metadata } from 'next'; +import GoogleTagManagerScript from '../components/head/GoogleTagManagerScript'; // Nextjs automatically includes for each route two default meta tags, charset and viewport // https://nextjs.org/docs/app/building-your-application/optimizing/metadata#default-fields @@ -15,7 +16,14 @@ export default function RootLayout({ }) { return ( - {children} + + {/* + We should be using next third party library https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries#google-tag-manager + but sending an event using sendGTMEvent requires an object rather than a list of arguments so the current gtag api function would need to be adapted + */} + + {children} + ); } diff --git a/components/head/GoogleTagManagerScript.tsx b/components/head/GoogleTagManagerScript.tsx index 317d49377..47736c0c5 100644 --- a/components/head/GoogleTagManagerScript.tsx +++ b/components/head/GoogleTagManagerScript.tsx @@ -4,7 +4,7 @@ const GoogleTagManagerScript = () => { return (