Skip to content

Commit 048a7eb

Browse files
committed
fix: Disable gtag in dev to prevent window.gtag error
Signed-off-by: Atul Chahar <[email protected]>
1 parent 646d297 commit 048a7eb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docusaurus.config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//@ts-check
22

3-
import {themes as prismThemes} from "prism-react-renderer";
3+
import { themes as prismThemes } from "prism-react-renderer";
44
const path = require("path");
5-
import {visit} from "unist-util-visit";
5+
import { visit } from "unist-util-visit";
66
const FontPreloadPlugin = require("webpack-font-preload-plugin");
77

88
/** @type {import('@docusaurus/types').DocusaurusConfig} */
@@ -50,7 +50,7 @@ module.exports = {
5050
content:
5151
"API testing, Keploy docs, incident replay, network calls, code paths, test scenarios, code coverage, stubs, junit, go-test, live environment, production incidents, open source, regression tests, ai tests",
5252
},
53-
{name: "twitter:card", content: "summary_large_image"},
53+
{ name: "twitter:card", content: "summary_large_image" },
5454
],
5555
headTags: [
5656
// Preconnect tag
@@ -343,11 +343,12 @@ module.exports = {
343343
theme: {
344344
customCss: require.resolve("./src/css/custom.css"),
345345
},
346-
gtag: {
346+
// Only enable gtag in production to avoid window.gtag errors in local dev
347+
gtag: !(process.env.NODE_ENV === 'development') ? {
347348
trackingID: "G-LLS95VWZPC",
348349
// Optional fields.
349350
anonymizeIP: true, // Should IPs be anonymized?
350-
},
351+
} : undefined,
351352
// Will be passed to @docusaurus/plugin-content-sitemap
352353
sitemap: {
353354
// Per v2.0.0-alpha.72 cacheTime is now deprecated

0 commit comments

Comments
 (0)