This playground demonstrates how to track custom events in a Next.js project using Google Tag Manager (GTM). For more details, please refer to this RFC.
- Node.js >= 18
-
First, install the dependencies:
pnpm i
-
Then, run the development server:
pnpm dev
-
Open http://localhost:3000 with your browser to see the result.
-
Refer to this document on how to debug a GTM tag and GA4 event.
-
Done. Happy debugging!
A tenant_ready
event which contains tenant_id
as one of the user_properties
will be tracked when the web app first loads.
/
- homepage, trackshome_load
event/about
- About page, tracksabout_load
event/error
- Error page, does not track any custom event/other
- Other page, tracksother_load
event/other/[id]
- Other by ID page, which is a carousel in the middle of the Other page that displays a list of links to other pages by ID, tracksother_id_load
event