From 0e1132153a211cb4cfdcf6222993e7393faa4947 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 7f9f9dda9210b17c4a2d2945e65a17cd5a4eb2ce 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 8c1efc2a434a5c6b9f33ba93dc863f7f9d5b19e6 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 44ce910322414db4e6c80b3229914510424a599e 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 4579b2ffeb078ef651659096873ccbcb8be7ea18 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 50dec7b972c15b75f583f9aa46ba569b4cc17d0a 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 (