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'); + });