From 28b9a57cab99020511705e008ae85e9e6d9ab804 Mon Sep 17 00:00:00 2001 From: "john.xlm" <60260750+JFWooten4@users.noreply.github.com> Date: Thu, 30 Apr 2026 06:34:24 -0400 Subject: [PATCH] Patch Docusaurus gtag page view guard --- patches/@docusaurus+plugin-google-gtag+3.9.2.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 patches/@docusaurus+plugin-google-gtag+3.9.2.patch diff --git a/patches/@docusaurus+plugin-google-gtag+3.9.2.patch b/patches/@docusaurus+plugin-google-gtag+3.9.2.patch new file mode 100644 index 0000000000..7bbfa6803c --- /dev/null +++ b/patches/@docusaurus+plugin-google-gtag+3.9.2.patch @@ -0,0 +1,14 @@ +diff --git a/node_modules/@docusaurus/plugin-google-gtag/lib/gtag.js b/node_modules/@docusaurus/plugin-google-gtag/lib/gtag.js +index dd152ea1..dd7a7914 100644 +--- a/node_modules/@docusaurus/plugin-google-gtag/lib/gtag.js ++++ b/node_modules/@docusaurus/plugin-google-gtag/lib/gtag.js +@@ -18,6 +18,9 @@ const clientModule = { + setTimeout(() => { + // Always refer to the variable on window in case it gets overridden + // elsewhere. ++ if (typeof window.gtag !== 'function') { ++ return; ++ } + window.gtag('set', 'page_path', location.pathname + location.search + location.hash); + window.gtag('event', 'page_view'); + });