From 8bf2a9bb264fd3bae3f5e86933e5024510a8a80c Mon Sep 17 00:00:00 2001 From: MarianKijewski Date: Thu, 9 Jul 2026 17:30:18 +0200 Subject: [PATCH 1/2] Add Google Tag Manager dependency --- package-lock.json | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/package-lock.json b/package-lock.json index b12a3e8..9d97a0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "dependencies": { "@docusaurus/core": "^3.10.1", "@docusaurus/faster": "^3.10.1", + "@docusaurus/plugin-google-tag-manager": "^3.10.1", "@docusaurus/preset-classic": "^3.10.1", "@docusaurus/theme-common": "^3.10.1", "@docusaurus/theme-mermaid": "^3.10.1", diff --git a/package.json b/package.json index 0d84d51..15bd5d2 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dependencies": { "@docusaurus/core": "^3.10.1", "@docusaurus/faster": "^3.10.1", + "@docusaurus/plugin-google-tag-manager": "^3.10.1", "@docusaurus/preset-classic": "^3.10.1", "@docusaurus/theme-common": "^3.10.1", "@docusaurus/theme-mermaid": "^3.10.1", From 28b0c575a6c816a7fec571db0549f737148ff563 Mon Sep 17 00:00:00 2001 From: MarianKijewski Date: Thu, 9 Jul 2026 18:11:23 +0200 Subject: [PATCH 2/2] Send page view event to Google Tag Manager --- docusaurus.config.js | 3 +++ src/theme/Root/index.js | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/theme/Root/index.js diff --git a/docusaurus.config.js b/docusaurus.config.js index f7ce94e..f86f571 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -47,6 +47,9 @@ const config = { theme: { customCss: './src/css/custom.css', }, + googleTagManager: { + containerId: 'GTM-KMKCCQD4' + } }), ], ], diff --git a/src/theme/Root/index.js b/src/theme/Root/index.js new file mode 100644 index 0000000..c22c998 --- /dev/null +++ b/src/theme/Root/index.js @@ -0,0 +1,15 @@ +import React from 'react'; +import { useLocation } from '@docusaurus/router'; +import * as CookieConsent from 'vanilla-cookieconsent'; + +export default function Root({ children }) { + const location = useLocation(); + + React.useEffect(() => { + if (CookieConsent.acceptedCategory('analytics') && window.dataLayer) { + window.dataLayer.push({event: 'pageview'}); + } + }, [location]); + + return <>{children}; +}