Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix gtmHeadSnippet on cloud instances

Carlos Monastyrski7624d7ed2ee8
diff --git a/backend/src/server/plugins/serve-ui.ts b/backend/src/server/plugins/serve-ui.ts
index 74affba309..8fc0134f39 100644
--- a/backend/src/server/plugins/serve-ui.ts
+++ b/backend/src/server/plugins/serve-ui.ts
@@ -75,20 +75,6 @@ export const registerServeUI = async (
}
}
- if (appCfg.isCloud) {
- const GTM_ID = "GTM-WL5C7MWT";
-
- const gtmHeadSnippet = `<!-- Google Tag Manager -->\n<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\nnew Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\nj=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n})(window,document,'script','dataLayer','${GTM_ID}');</script>\n<!-- End Google Tag Manager -->`;
-
- const gtmBodySnippet = `<!-- Google Tag Manager (noscript) -->\n<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=${GTM_ID}"\nheight="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>\n<!-- End Google Tag Manager (noscript) -->`;
-
- // Insert GTM script right before </head>
- indexHtml = indexHtml.replace("</head>", `${gtmHeadSnippet}\n</head>`);
-
- // Insert GTM noscript right after <body>
- indexHtml = indexHtml.replace("<body>", `<body>\n${gtmBodySnippet}`);
- }
-
// Inject GTM/analytics CSP domains only for Infisical Cloud deployments
if (appCfg.isCloud) {
const cloudCspExtensions: Record<string, string[]> = {